After a feature is implemented or a bug is fixed, write tests that cover the changes:
- •Focus on behavior -- Test what the code does, not how it does it. Tests should survive refactoring.
- •Cover the happy path first -- Then add edge cases and error cases.
- •Keep tests small -- One assertion per test when practical. Each test should verify one thing.
- •Use the project's existing test framework -- Match the patterns and conventions already in use. If none exist, ask the user what framework to use before writing tests.
- •Name tests clearly -- The test name should describe the expected behavior (e.g.,
returns_empty_list_when_no_results).
Do not write tests for code that wasn't changed. Do not add test utilities or helpers unless they're needed more than once.