E2E Testing ChatBot, AI Agent, RAG, MCP Server with DeepEval Framework

Test and evaluate LLM apps, chatbots, AI agents, RAG pipelines, and MCP servers with DeepEval.
3
hands-on projects
29
metric rows you will run
4
systems: chatbot · RAG · agent · MCP
25
pytest files
2
surfaces: CI gate + dashboard
✓ DeepEval 3.9.9✓ LLM-as-judge✓ pytest + CI✓ FastAPI dashboard✓ OpenAI · Groq · Ollama✓ Full GitHub project

Course Summary

A complete guide to testing AI systems with the DeepEval framework. Build evaluation suites for chatbots, AI agents, RAG pipelines, and MCP servers: measure hallucination, answer relevancy, faithfulness, and tool-use correctness, then wire evals into CI. Hands-on projects for QA engineers and AI developers who need reliable, measurable AI quality.

the problem

Your test suite cannot see an AI bug

Ship a chatbot and the first bug report is never a stack trace. It is "the bot told a customer refunds take seven days." Status code 200. Schema valid. Response time fine. Every existing test green. The defect lives entirely inside the meaning of a sentence — and assertEquals cannot reach it.

What you used to assertWhy it breaks on an LLM appWhat replaces it
assertEquals(expected, actual)The same prompt returns different wording every callAnswer Relevancy — on topic, however phrased
200 OK + schema validA perfectly-shaped JSON can contain an invented policyFaithfulness / Hallucination
Regex / substring matchA paraphrase kills the match — the answer was still rightG-Eval Correctness — your rubric, graded by an LLM
Nobody tested tone or privacyBias, toxicity and PII leaks ship silentlyBias · Toxicity · PII Leakage
Manual spot-checks in a spreadsheetNot repeatable, cannot gate a buildA pytest suite with thresholds in CI
the outcome

What you will actually be able to do

Put a number on quality
Turn "the bot feels worse this week" into a score, a threshold and a red build.
Grade a chatbot
10 metrics on a real React + FastAPI + Groq support bot: relevancy, faithfulness, hallucination, bias, toxicity, PII, multi-turn memory.
Grade a RAG pipeline
11 metrics including the three retrieval metrics that tell you whether the retriever or the generator caused the wrong answer.
Grade an AI agent
Task success, tool choice and argument correctness as G-Eval rubrics on top of the standard quality rows.
Grade an MCP server
Wrap a tool call so the result becomes the output under test — then every faithfulness and correctness metric applies unchanged.
Grade a bot you do not control
The realistic enterprise case: a live vendor bot, plain-text responses, no visibility into its prompt.
Run it in CI
Marker-sliced fast gates on every pull request, a full 29-row sweep nightly, HTML reports as build artefacts.
Ship a dashboard
A FastAPI app on :8203 — click a metric, get a live score, pass/fail and the judge's written reason.
how it works

The one diagram behind the whole course

System under testchatbot · RAGagent · MCP serverHTTPLLMTestCaseinput · actual_outputcontext · retrievalMetric+ your thresholdJudge LLMseparate modelscorepass / failwrittenreasonCI gatered or greenThe grader and the thing being graded are different models — that is what makes the score independent.
end to end

The complete curriculum

01
Foundations — why LLM apps break every assertion you know
Lesson 1 · Part 1
  • The five ways an AI defect hides from a traditional suite: non-determinism, silent failure, invisible grounding, multi-dimensional quality, no release gate
  • LLM-as-judge explained properly — and why the judge must never be the model under test
  • The LLMTestCase primitive: input, actual_output, expected_output, retrieval_context, context
  • Which field unlocks which metric — the lookup table you will use every day
02
Installation, judge selection and the version pin that saves an evening
Lesson 1 · Part 2
  • Python 3.10+, venv, and the full pinned dependency set
  • Why deepeval must be 3.9.9 and what breaks in 4.0.6
  • One switchable judge factory for OpenAI, Groq and fully-offline Ollama — no code changes
  • The .env trap: why your app under test silently drops into mock mode
  • Verifying the install in three commands before you write a single metric
03
The metric architecture — all 29 rows, decoded
Lesson 1 · Part 3
  • The MetricDef registry pattern: one row per (metric × target), one source of truth, two surfaces
  • The five categories: quality, retrieval, safety, geval, conversational
  • Every row with its shipped threshold — 10 chatbot · 11 RAG · 7 live-bot · 1 synthetic
  • Score direction: quality is a floor, safety is a ceiling, and the mistake that inverts your whole report
  • Goldens as the real QA artefact — grounding, categories, adversarial prompts, versioning in git
04
Project 1 — grade a real support chatbot
Lesson 2 · Project 1
  • Stand up ShopSphere: React + FastAPI + Groq llama-3.3-70b-versatile on :8201
  • Write the target client that absorbs its HTTP contract
  • Author 19 goldens plus 13 adversarial safety prompts, grounded in real policy
  • Wire all 10 metric rows and 7 pytest files
  • Read a real failure: the judge's reason string is the bug report
05
Project 2 — grade a RAG pipeline, retriever included
Lesson 2 · Project 2
  • A full local pipeline with every stage exposed: ingest → chunk → embed → ChromaDB → retrieve → answer
  • Ollama nomic-embed-text embeddings and a 5-file e-commerce corpus
  • The three retrieval metrics explained without jargon — precision, recall, relevancy
  • Citation quality, helpfulness and summarization as custom G-Eval rubrics
  • The debugging skill that makes you valuable: retriever problem or generator problem?
06
Project 3 — grade a live bot you do not control
Lesson 2 · Project 3
  • A remote black-box bot: plain-text responses, session ids, no visible system prompt
  • Bootstrapping goldens from the bot's own behaviour — and why you must hand-verify them
  • PII and prompt-leak probes as the only leakage test available against a vendor
  • Liveness markers that auto-skip instead of failing the build
  • Why this suite pins its judge to OpenAI, and how rate limits ruined the first attempt
07
Extending it — AI agents and MCP servers
Lesson 2 · Part 4
  • The five-step recipe for any new target: client → goldens → fixture → registry rows → suites
  • AI agents: grading the final message and the tool trace; a task-success rubric
  • MCP servers: turning a tool result into actual_output and the tool's data into context
  • Rubrics for tool choice and argument correctness
  • The reusable skill file that regenerates this whole architecture for your own product
08
Ship it — dashboard, CI and cost control
Lesson 2 · Part 5
  • The FastAPI dashboard: overview analytics, editable goldens, live metric runs, run history
  • A GitHub Actions workflow: fast marker-sliced gate per PR, full sweep nightly
  • HTML reports as build artefacts, parallel runs with pytest-xdist
  • Confident AI cloud reporting via deepeval test run — and the assert_test trap
  • Keeping the judge bill small: gpt-4o-mini for CI, local Ollama for development
the full coverage map

The 29 metrics you will run

A · Chatbot10 rows
answer relevancy · faithfulness · hallucination · bias · toxicity · G-Eval completeness · G-Eval no-prompt-leak · conversation completeness · knowledge retention · PII leakage
B · RAG pipeline11 rows
contextual precision · contextual recall · contextual relevancy · faithfulness · answer relevancy · hallucination · G-Eval correctness · G-Eval citation quality · G-Eval helpfulness · bias · toxicity
BB · Live black-box bot7 rows
answer relevancy · faithfulness · hallucination · bias · toxicity · G-Eval correctness · PII leakage
Synthetic1 row
summarization — no running app required
⬆⬇ The thing most people get wrong
Quality metrics are a floor — the score must climb above the threshold. Safety metrics are a ceiling — hallucination, bias, toxicity and PII leakage must stay below it. Get that backwards and your report says the opposite of the truth. We cover the exact direction for all 29 rows.
audience

Who this is for

Manual and automation QAs
Your team just shipped an AI feature and asked you to sign it off. This is the missing skill.
SDETs and automation leads
You already own the CI pipeline. Now you own the eval gate that sits inside it.
QA leads and managers
You need a defensible answer to "is it good enough to ship?" — a table of numbers, not a vibe.
Developers building AI features
Stop shipping prompt changes blind. Score them before the customer does.
Anyone testing chatbots, RAG, agents or MCP
If it answers over HTTP, everything in this course applies to it.
You should already haveDepth needed
PythonComfortable reading and writing functions and classes — no advanced work required
pytestBasics: test functions, fixtures, parametrize, markers. We revise markers in class.
HTTP and JSONYou can read a curl command and a JSON response
LLM experienceNone assumed. Prompts, embeddings, RAG and judging are all explained from zero.
An API keyHelpful, not required — local Ollama and mock mode let you follow along free
deliverables

What you take home

  • A working evaluation harness with 29 metric rows across three real systems under test
  • Three target clients that absorb three different HTTP contracts, including plain text
  • 41 goldens you authored and grounded yourself, plus safety and PII probe sets
  • 25 pytest files, marker-sliced so you can run exactly what you need
  • A FastAPI dashboard with live scores, judge reasons and local run history
  • A GitHub Actions workflow you can paste into your own repository tomorrow
  • The reusable skill playbook that rebuilds this architecture for your product
  • Two written lessons, permanent access, exhaustively diagrammed
what class looks like

A taste of the code

this is a complete, real LLM test
import pytest from deepeval import assert_test from deepeval.test_case import LLMTestCase from deepeval.metrics import FaithfulnessMetric from datasets.rag_goldens import RAG_GOLDENS @pytest.mark.rag @pytest.mark.quality @pytest.mark.needs_rag @pytest.mark.parametrize("golden", RAG_GOLDENS, ids=lambda g: g["input"][:40]) def test_rag_faithfulness(golden, rag, judge): res = rag.chat(golden["input"], top_k=4) case = LLMTestCase( input=golden["input"], actual_output=res.reply, retrieval_context=res.retrieval_context, # the chunks, verbatim ) # fails if ANY claim in the answer is not supported by the chunks assert_test(case, [FaithfulnessMetric(threshold=0.7, model=judge)])
and this is how you run it
pytest tests/rag/ -v # the whole target pytest -m "rag and retrieval" -v # retriever bugs only pytest -m safety -v # bias · toxicity · PII pytest tests/ -n 4 --html=report.html # the nightly sweep uvicorn dashboard.app:app --port 8203 # the live dashboard
FAQ

Common questions

Do I need an OpenAI API key?
No. Set JUDGE_PROVIDER=ollama and the judge runs locally with no key and no bill. The chatbot and RAG apps also fall back to mock mode without a key, so the framework always has a target to hit. A key just makes the scores steadier and the runs faster.
Is this only about DeepEval, or transferable?
The metrics come from DeepEval, but the architecture — registry of metric-by-target rows, target clients that absorb HTTP contracts, versioned goldens, thresholds as the gate — is framework-agnostic. Swap the metric library and the design survives.
I have never worked with LLMs. Will I keep up?
Yes. Prompts, embeddings, chunking, retrieval and LLM-as-judge are all built from zero in Lesson 1. The Python and pytest is the part we assume, and that is the part you already have.
Does this cover AI agents and MCP servers, or just chatbots?
Both are covered explicitly. Agents get task-success and tool-choice rubrics on top of the standard quality rows. MCP servers slot in by treating a tool call as a chat turn — the tool result becomes the output under test and the tool's data becomes the ground-truth context.
Will the judge scores be stable enough to gate a build?
Stable enough if you use them correctly: a small low-temperature judge, thresholds set with headroom, and trends read across runs rather than single numbers. We cover exactly where LLM judging is reliable and where it is not.
How much will the judge calls cost me?
Almost nothing if you follow the cost discipline in the course: develop against two or three goldens, use gpt-4o-mini, run the full 29-row sweep nightly rather than per commit, or run entirely on local Ollama for free.
Do I get the full source project?
Yes — the complete Chapter_19_DeepEval_Framework project on GitHub: all three subsystems, the registry, the goldens, the dashboard, all 25 test files and the reusable skill playbook.
What if I get stuck?
Every lesson ships with a troubleshooting table built from the errors students actually hit — the broken CLI version, the empty-context crash, the 429s, the mock-mode confusion and the inverted thresholds.
Stop guessing whether the AI is good enough
Build the eval harness that turns "it feels worse" into a number, a threshold and a red build.
Three projects. 29 metrics. Chatbots, RAG pipelines, AI agents and MCP servers. The full GitHub project and lifetime access.
Lifetime accessFull source projectWritten notes + diagramsNo LLM experience needed

Course Curriculum

Pramod Dutta

Founder of The Testing Academy, a YouTube Channel with 95K subscribers where Pramod teaches about Software testing & Test Automation. With overall 10+ years of experience in Software Testing & Test Automation, he has mentored 10,000+ students in Software Testing, API Testing, Test Automation.

Pramod Dutta is working as SDET Manager at Tekion | Ex BrowserStack Employee & BrowserStack Champion & Certified Scrum Master. Pramod has a vast range of experience handling from Manual Testing, Mobile & Web Automation, Desktop & cloud services like AWS, GCP extra.

By joining this Automation Testing Course , you’ll have the opportunity to take control of your life, work in an exciting industry with infinite possibilities and live the life you want.

John Smith

Developer

Highly Recommended Course. Easy to Understand, Informative, Very Well Organized. The Course is Full of Practical and Valuable for Anyone who wants to Enhance their Skills. Really Enjoyed it. Thank you!!

Course Pricing

Full Course

4999 INR

Buy Now