Write Tests
Required Pre-Writing Analysis
Before writing tests, answer:
- •What is the core logic or algorithm?
- •What are the inputs and outputs, including edge/boundary/invalid cases?
- •What invariants must always hold?
- •What failure modes are realistic (bad data, misuse, race conditions)?
Test Rules
- •Test behavior, not implementation details.
- •Minimize mocking; mock only true external dependencies.
- •Avoid tautological tests (mock X, assert X with no logic in between).
- •Exercise real branches and error paths.
- •Use concrete, realistic data.
- •Name tests with clear hypotheses.
Verification Checklist
- •Could each test fail if corresponding logic were broken?
- •Are core decisions being tested, not only wiring?
- •Are happy path, edge cases, error conditions, and boundaries covered?
- •If mocks were removed, would meaningful logic remain under test?
Output
- •Present the pre-writing analysis.
- •Add/update tests based on that analysis.
- •Run tests and confirm pass/fail status.
- •Report the verification checklist with conclusions.