Coding & EngineeringIntermediate15-30 minutes per function

Test Generation

Test quality depends on case design, not count. This skill designs cases with equivalence classes, boundaries and fault injection, has AI write them, then uses mutation testing to check the tests themselves.

Workflow

  1. 1

    Enumerate the input space

    List normal values, boundaries, empty values, invalid types, oversized inputs and concurrency scenarios. Cover each equivalence class instead of writing one “success” case.

  2. 2

    Inject realistic failures

    Simulate timeouts, duplicate requests, partial failures, dirty dependency responses and insufficient permissions. Assert error handling and side effects, not just that an exception was thrown.

  3. 3

    Generate and review test code

    Require one behavior per test with names that state scenario and expectation. Remove duplicated setup and avoid shared mutable state between tests.

  4. 4

    Validate with mutation testing

    Deliberately break the implementation (negate conditions, remove boundary checks) and see whether tests fail. Surviving mutants mean the logic is not truly covered; add cases before shipping.

Recommended prompts

FAQ

Is higher coverage always better?

No. Coverage only shows code was executed, not that assertions are meaningful. Mutation testing and escaped defects better reflect test quality.

Can AI-generated tests be used directly?

Review whether assertions and mocks match real dependency behavior. Common issues are over-mocking, asserting implementation details and missing side effects.

Related skills