testing
Installation
SKILL.md
Testing Strategy
- Test Pyramid: More unit and widget tests, fewer integration tests. Unit tests are fastest and cheapest.
- Mirror Test Rule: 100% logic and widget coverage. No code without a test.
- Mirror Organization: Test files MUST strictly mirror the
lib/directory structure and end with_test.dart. - Coverage Targets: Target 100% logic coverage for
domainandbloclayers. - Test Independence: Each test MUST be independent. No shared mutable state between tests.
Unit Testing
- Follow the Arrange-Act-Assert (Given-When-Then) convention for clear and maintainable tests
- Use mocks for dependencies except for lightweight third-party services
- Test business logic in isolation from the UI
- For tests, ensure to create 5 to 8 tests for logical operations with real scenarios
- Mocking Protocol: Use
mocktailfor all dependency mocking. STRICTLY prohibit using real implementation dependencies in unit tests. - Pure Logic: Business logic inside BLoCs or UseCases should be extracted to static pure functions for 100% unit test coverage.