By Abhijith N M · Reviewed 24 October 2026 · Editorial standards
A single DeepEval test is a demo. A framework is what lets you run three hundred cases, understand which ones failed, and trust the answer. Almost every AI test framework — commercial or home-grown — has the same five stages.
| Stage | Responsibility | A common mistake |
|---|---|---|
| Dataset | Load cases, validate shape, filter by tag | Evaluating rows that are missing sources |
| Executor | Call the system, capture output and artefacts (chunks, tool calls, latency) | Capturing only the answer text, then wondering why debugging is hard |
| Scorer | Rules, then metrics, then judge — cheapest first | Running the judge on cases a regex already failed |
| Aggregator | Means, floors, per-case diffs vs baseline | Reporting only the mean |
| Reporter | A verdict a human can act on | Dumping raw JSON and calling it a report |
Keep the executor, the scorer and the gate as three separate pure-ish modules. Then you can test the gate with fake scores (fast, free) and only the executor needs the network.
# executor.py
def run_case(case: dict) -> dict:
"""Call Nova and capture everything needed to judge it."""
result = nova_answer(case["question"])
return {
"id": case["id"],
"question": case["question"],
"answer": result.text,
"contexts": [c["text"] for c in result.chunks],
"chunk_ids": [c["id"] for c in result.chunks],
"latency_ms": result.latency_ms,
"tokens": result.tokens,
"finish_reason": result.finish_reason,
}# scorer.py
def score_case(artifact: dict) -> dict:
"""Cheap checks first. Return early on a rule failure."""
violations = check_rules(artifact["answer"])
if violations:
return {"id": artifact["id"], "passed": False, "reasons": violations}
faithfulness = judge_faithfulness(artifact)
return {
"id": artifact["id"],
"passed": faithfulness >= 0.85,
"faithfulness": faithfulness,
"reasons": [] if faithfulness >= 0.85 else ["faithfulness below floor"],
}Every failure must be explainable without re-running anything. That means the run directory should contain, for each failing case: the question, the answer, the retrieved chunks, the judge's reason, and the score. results/run-2026-11-20T09-14/q_014.json.
| Runner | Good for | Trade-off |
|---|---|---|
| pytest | Almost everything; familiar, fixtures, parametrise | Parallelism needs plugins |
| A plain Python script | Small suites, CI jobs, quick loops | You rebuild reporting yourself |
| DeepEval's own CLI | Fast start, built-in metrics | Less control over execution |
| A workflow engine | Large nightly matrices across models | Overkill until you have dozens of suites |
Start with pytest and parametrised cases. It is boring, and boring is what you want from a test runner at 2 AM.
Key takeaways
Five stages: dataset, executor, scorer, aggregator, reporter.
Keep executor, scorer and gate separate so most tests need no network.
Capture artifacts — chunks, tool calls, latency, judge reason — for every case.
Start with pytest; add tooling only when the suite outgrows it.
Written and edited by the nexGenCoders team. Spotted a mistake? Tell us and we will fix it.
Don't lose this lesson
Create a free account to save your progress, keep your streak, and work toward a shareable certificate.