Workflow Testing

Add Test Coverage

Workflow for improving coverage on an untested area of code

testingcoveragequality
CLAUDE.md

When adding test coverage to existing untested code:

  1. Run the coverage tool to identify which functions and branches are uncovered.
  2. Prioritize business-critical code and code with high change frequency.
  3. Start by writing tests for the current behavior — even if you suspect bugs. Capture what the code does now.
  4. Use the existing test patterns in the project. Don’t introduce a new testing style.
  5. Focus on behavior, not lines. A test that verifies correct output for a given input is more valuable than one that merely executes code.
  6. After adding tests, run mutation testing or break the code deliberately to verify your tests actually catch failures.

Copy this workflow into your CLAUDE.md or agent config file so your agent follows this process automatically.

get crystl