# Test Case Generation Agent

> A test-case agent that turns requirements into happy-path, edge, and negative cases with steps and expected results, flagging ambiguous specs instead of guessing.

- **Category:** QA & Testing
- **Difficulty:** Intermediate
- **Setup time:** 40 min
- **Stacks:** Claude, LangGraph, OpenAI
- **Version:** 2.0.0 (updated 2026-06-21)
- **Source:** https://agent-kits.com/kit/test-case-generator

## Overview

Turns requirements and user stories into structured test cases with steps and expected results.

Covers happy paths, edge cases, and negative cases grounded in the actual requirement.

Flags ambiguous or underspecified requirements instead of inventing expected behavior.

Defensive: marks assumptions and never claims coverage it cannot guarantee.

## When to use it

- You want first-draft test cases generated from requirements quickly.
- You have requirements or acceptance criteria the cases can be grounded in.
- You want edge and negative cases surfaced, not just the happy path.
- You want ambiguous requirements flagged rather than silently assumed.

## When not to use it

- You expect it to invent expected results for vague requirements — it flags instead.
- You want guaranteed full coverage claims (it states what's covered and what isn't).
- You have no requirement or spec for it to work from.
- You need it to execute tests rather than author them (that's a runner).

## Architecture

- **Requirement intake** — Receives the requirement, user story, or acceptance criteria that all test cases must be grounded in.
- **Criteria parser** — Breaks the requirement into testable conditions and identifies what is and isn't specified.
- **Case generators** — Produces happy-path, edge, and negative cases with steps and expected results tied to specific criteria.
- **Grounding guard** — Ensures each expected result follows from the requirement and blocks invented behavior.
- **Ambiguity detector** — Flags unmeasurable or missing detail with the question that needs answering instead of guessing a value.
- **Assumption tracker** — Labels any assumption made to write a case so the author can confirm or correct it.
- **Coverage reporter** — States honestly what the cases cover and what they don't, avoiding false full-coverage claims.

## Files in this bundle

- `system-prompt.md` — the agent's system prompt
- `tools.json` — tool/function definitions the agent expects
- `workflow.md` — step-by-step run loop
- `.env.example` — environment variables to fill in
- `kit.json` — full structured metadata
- `starters/` — minimal starter snippets
- `LICENSE` — Apache-2.0 (code, configuration, and schema)
- `LICENSE-CONTENT` — CC BY 4.0 (specification text and documentation)
- `NOTICE` — attribution and trademark notice
- `run.py` — **runnable demo**: real agent loop with mock tools (`pip install anthropic`, set `ANTHROPIC_API_KEY`, `python run.py`)
- `agentaz.json` / `agentaz.schema.json` — AgentAz™ governance spec + schema

## Implementation notes

- Tie every expected result to a specific criterion; an invented expected value produces a test that's arbitrary and misleads whoever reads the results.
- Flag unmeasurable requirements ('fast', 'user-friendly') with the concrete question needed, rather than fabricating a threshold to make a test writable.
- Never claim full or 100% coverage; enumerate honestly what's untested (integration, performance, security, concurrency), since a false coverage claim ships bugs.
- Include edge and negative cases by default, not just the happy path, as that's where most real defects live.
- Label assumptions explicitly so a QA author can confirm boundaries (e.g. whether the lock triggers on the 5th attempt).
- Keep the agent authoring tests, not certifying correctness or release-readiness, which remains a human QA decision.
- The strong model earns its cost on grounding and ambiguity detection, while a cheaper model can format and expand straightforward cases.

## Variations

- **Basic — Case drafter:** Generates happy-path and basic negative test cases from a requirement with steps and expected results.
- **Advanced — Grounded coverage with flags:** Adds edge/security cases, grounding guards, ambiguity flagging, assumption tracking, and an honest coverage note.
- **Enterprise — QA generation pipeline:** Adds requirement-tool and test-management integration, Gherkin/automation-ready output, traceability to criteria, and review workflows at scale.

## FAQ

**Does it make up expected results?**

No. Each test case's expected result must follow from the stated requirement or acceptance criteria. If a behavior isn't specified, it flags it as an open question rather than inventing an expected value.

**What happens with a vague requirement?**

It flags the ambiguity and asks for the missing detail — for example, turning 'should be fast' into a request for a measurable performance target — instead of fabricating a threshold like '<200ms' and treating it as a spec.

**Will it tell me I have full coverage?**

No, and that's deliberate. It reports what the cases cover and honestly lists what they don't (integration, performance, security, concurrency), because a false 100%-coverage claim is how bugs reach production.

**Does it cover more than the happy path?**

Yes. It generates edge cases (boundaries, empty/large inputs) and negative cases (invalid input, errors, permissions) by default, and security-relevant cases where the requirement supports them.

**Can it output automation-ready cases?**

Yes. It can produce Gherkin or structured steps/expected formats that fit your test-management or automation tooling, with traceability back to the criteria.

**Does it decide if the software is ready to ship?**

No. It authors test cases; it doesn't certify correctness or release-readiness. Those judgments stay with your QA team.


---

© 2026 AgentKits · www.agent-kits.com

**Open source.** Code, configuration, and the AgentAz™ schema are licensed under
**Apache-2.0**; specification text and documentation under **CC BY 4.0** (with
attribution to AgentKits, link to https://www.agent-kits.com). See LICENSE, LICENSE-CONTENT,
and NOTICE in this bundle. "AgentAz" and "AgentKits" are trademarks of AgentKits.

**Flagship reference blueprint.** View the source, AgentAz™ spec, and frozen v1.0 schema
in the public registry: https://github.com/agent-kits/agentaz
Original: https://agent-kits.com/kit/test-case-generator
