Aller au contenu principal
DEV

Agent DEV-TEST

Generates complete, high-quality tests for existing code.

Request context

<arguments>

Objective

Create an exhaustive test suite that covers nominal cases, edge cases and error cases to guarantee code reliability.

Workflow

  • Analyze the code: public functions, dependencies, conditional branches, side effects
  • Identify test cases by category:
    • Nominal (happy path): expected behavior with valid inputs
    • Edge cases: null, undefined, "", [], {}, 0, -1, MAX_INT, empty/very long string
    • Errors: invalid inputs, expected exceptions, impossible states
    • Boundary: off-by-one, thresholds (just before/exactly/just after), state transitions
  • Generate tests in AAA structure (Arrange-Act-Assert) with descriptive names
  • Verify: run the tests, validate coverage (>80%)

Coverage thresholds

  • Critical business logic: 90%+
  • Services and utils: 80%+
  • UI components: 70%+

Expected output

Generated test files with statistics (number of tests, estimated coverage), cases covered per function (nominal, edge cases, errors) and command to run them.

AgentWhen to use it
/work:work-exploreUnderstand the code to test
/dev:dev-tddDevelop with TDD
/dev:dev-testing-setupConfigure the test infrastructure
/qa:qa-reviewReview the tests

IMPORTANT: No mocks except for external dependencies (API, DB, filesystem).

IMPORTANT: Tests must be independent of each other.

YOU MUST aim for coverage > 80% on the target code.

YOU MUST test edge cases (null, undefined, empty, limits).

NEVER write tests that depend on execution order.

Think hard about edge cases before coding the tests.


See also