Overview
The project uses:- Backend: Frappe’s testing framework based on Python’s
unittest - Frontend: Vite development server for manual testing
- CI/CD: GitHub Actions for automated testing on pull requests
Backend Testing
Test Structure
Backend tests are located alongside the code they test:Writing Tests
Tests inherit fromfrappe.tests.IntegrationTestCase:
Test Utilities
The project provides helper functions inhelpdesk/test_utils.py:
Time-Based Testing
For testing SLA and time-dependent features, useself.freeze_time():
Running Backend Tests
Run All Tests
Run Specific Test File
Run Specific Test Method
Run Tests with Coverage
~/frappe-bench/sites/coverage.xml.
Enable Verbose Output
Test Setup and Teardown
Thetest_utils.py file includes a before_tests() function that runs before all tests:
Frontend Testing
Development Server
For frontend testing, use the Vite development server:http://localhost:8080(default Vite port)http://helpdesk.test:8080(with host mapping)
Frontend Testing Practices
- Manual Testing: Test UI changes in the browser
- Component Testing: Verify components work in isolation
- Integration Testing: Test complete user flows
- Browser Testing: Test across different browsers
- Responsive Testing: Test on different screen sizes
Development Build
Build the frontend for production testing:CI/CD Testing
GitHub Actions Workflow
Tests run automatically on pull requests tomain, main-hotfix, and develop branches.
The workflow:
- Sets up Python 3.14 and Node.js 24
- Installs MariaDB 10.6
- Installs Frappe Framework and dependencies
- Runs all backend tests with coverage
- Uploads coverage reports to Codecov
Test Coverage
The project uses Codecov for coverage tracking:- Coverage badge:
- Target: Maintain or improve coverage with each PR
- Coverage reports are generated automatically in CI
Writing Good Tests
Best Practices
- Test One Thing: Each test should verify a single behavior
- Use Descriptive Names:
test_ticket_creation_with_high_priority() - Arrange-Act-Assert: Structure tests clearly:
- Clean Up: Always clean up test data in
tearDown() - Avoid Dependencies: Tests should not depend on each other
- Test Edge Cases: Include tests for error conditions and boundary values
Common Test Patterns
Testing DocType Creation
Testing Field Validation
Testing API Endpoints
Testing Workflows
Debugging Tests
Print Debugging
Using the Debugger
Checking Database State
Testing Checklist
Before submitting a pull request:- All existing tests pass
- New functionality includes tests
- Edge cases are tested
- Tests are documented with clear names
- No test data leaks between tests
- Tests run in isolation
- Coverage is maintained or improved
- Frontend changes are manually tested
Resources
- Frappe Testing Documentation
- Python unittest Documentation
- Vue Test Utils (for future reference)
Getting Help
If you need help with testing:- Review existing test files for examples
- Ask in the Telegram group
- Post on the Discuss forum
- Check the Frappe Framework testing documentation