Lesson 6 of 7 · Individual agent
The Unit Tester agent
Unit tests are the backbone of software development. The Unit Tester can be called directly, or used by the Orchestrator in the testing stage of the larger SDLC. The Unit Tester understands the testing patterns and standards for the code being worked on, and helps create or improve tests around an implementation.
When to use the Unit Tester
- Discovering existing test patterns and frameworks already in the project, rather than introducing a new one.
- Producing a gap analysis of missing scenarios, ranked High / Medium / Low priority.
- Writing new or updated tests and then running the full suite to confirm everything passes.
- Giving a clear sign-off verdict — Pass, Fail, or Conditional — with the specific gaps that still need resolving.
- Flagging when code is untestable as written, without silently patching production files.
How to use the Unit Tester
- Point the Unit Tester at the files or functions that were changed.
- Describe the behaviour that was added or modified.
- Name the test framework in use (Jest, pytest, xUnit, etc.).
- List expected scenarios and edge cases to cover, and any known limitations.
- If you're after a coverage gap-analysis rather than new tests, say which modules to focus on.
"I just added a new calculateDiscount function in src/pricing/discounts.ts that handles percentage discounts, fixed-amount discounts, and stacked discounts. Write unit tests covering the happy path for each discount type, edge cases like zero amount, negative values, and discounts exceeding the total, and verify it integrates with the existing applyToCart function."
Where the Unit Tester fits in the Orchestrator: the Unit Tester runs as Stage 4, using the changed files and handoff notes from the Coder. If tests fail, the Orchestrator sends the failure details back to the Coder for a fix, then re-runs the Unit Tester — up to two retry cycles before escalating to you.
Things to avoid
- Calling the Unit Tester before the requirement or behaviour is clear — the Unit Tester needs to know what the code is supposed to do to write meaningful tests.
- Asking the Unit Tester to fix production code; if the Unit Tester finds the code untestable, the Unit Tester reports what needs to change but won't modify production files.
- Introducing a new test framework into a project that already has one — the Unit Tester follows existing patterns.
Test your knowledge
The Unit Tester finds a function that can't be meaningfully tested as written. What does the Unit Tester do?
Source: documentation.md, "Unit Tester".