Coverage Requirements
This guide outlines the test coverage requirements and guidelines for Gradiant.Coverage Thresholds
Global Requirements
Critical Paths
The following areas require 100% coverage:- Authentication flows
- Data encryption/decryption
- Payment processing
- HIPAA compliance features
- Security middleware
- Error handling
- Data validation
Coverage Reports
HTML Report
Generate and view HTML coverage report:Coverage Badges
We use shields.io for coverage badges:Coverage Requirements by Type
Unit Tests
-
Components: 95% coverage
- All props combinations
- All state transitions
- Error boundaries
- Loading states
-
Services: 100% coverage
- All public methods
- Error cases
- Edge cases
- Timeout handling
-
Utils: 100% coverage
- All exported functions
- Input validation
- Error handling
Integration Tests
-
API Endpoints: 100% coverage
- All routes
- HTTP methods
- Status codes
- Response formats
-
Database Operations: 95% coverage
- CRUD operations
- Transactions
- Constraints
- Indexes
-
External Services: 90% coverage
- API calls
- Error handling
- Retry logic
- Rate limiting
E2E Tests
-
User Flows: 85% coverage
- Critical paths
- Authentication
- Data management
- Real-time features
-
UI Interactions: 80% coverage
- Navigation
- Forms
- Modals
- Responsive design
Excluded from Coverage
Configuration Files
- Environment configs
- Build scripts
- Type definitions
- Documentation
Test Files
- Test utilities
- Fixtures
- Mocks
- Test setup
Generated Code
- API clients
- GraphQL types
- Migration files
- Build output
Coverage Monitoring
CI/CD Integration
Local Monitoring
- Pre-commit hook:
- VS Code extension:
Best Practices
-
Regular Monitoring
- Check coverage reports daily
- Address coverage gaps promptly
- Track coverage trends
-
Coverage Quality
- Don’t just hit lines
- Test edge cases
- Verify actual behavior
-
Maintenance
- Update thresholds as needed
- Remove dead code
- Keep reports clean