Verification · Testing
Unit and integration tests
Example-based tests that run the code and assert on behaviour, from single functions up to services with real dependencies.
Sub-techniques
-
Unit tests
V1019.001Fast, isolated tests per function or class.
-
Integration tests with real services
V1019.002Run against real databases and queues in containers instead of mocks.
-
Regression test per bug
V1019.003Every fixed bug gets a test that failed before the fix.
-
Coverage gate
V1019.004Fail when coverage of changed lines drops below a threshold.
How to build it
- Write the failing test before the fix for every bug.
- Run integration tests against containers, not mocks, for storage and messaging code.
- Gate on coverage of changed lines, not overall coverage.
Signals in a repository
- tests/ or *_test.* files, plus test config in pyproject.toml, jest.config or vitest.config.
- A CI test job and a coverage upload step.