liveBook · Manning

Test-driven development

As explained in Enterprise RAG

Test-driven development is a software development approach in which tests are written before implementation and guide coding until the tests pass.

Test-driven development writes tests before implementation, then builds code that satisfies them. For automated RAG evaluations, expected questions and answers become executable checks before the chatbot is completed. section 2.4.3

A practical evaluation-driven workflow is:

  • Define evaluation questions and expected answers. section 2.4.3
  • Generate chatbot answers, compare each with its expected answer, and assert PASS. section 2.4.3
  • Run the checks locally and automatically on pushes to the main branch through GitHub Actions. section 2.4.3

RAG answer evaluation

A test asks who wrote “Dubious Parenting Tips,” expects “Lisa Melton,” generates an answer through the RAG system, and evaluates whether both answers provide the same information. section 2.4.3

Figure 2.4 The automated eval system for RAG development. Evals compare chatbot answers to expected outputs and automate testing via GitHub Actions, ensuring high-quality performance.

Trace the automated evaluation pipeline from expected outputs through chatbot comparison to GitHub Actions testing. section 2.4.3

How Enterprise RAG covers it

How deep it goes
Explains test definition, answer comparison, assertions, and continuous execution, but does not develop general TDD principles beyond automated evals.
Examples
Uses fictional book questions, expected answers, generated answers, a pytest test case, and a GitHub Actions workflow.
What it assumes
Assumes basic Python and Git usage while specifying Python 3.11, repository setup, dependencies, and environment-variable configuration.
What you can do after
Apply it via pytest and GitHub Actions to build and continuously check an automated RAG evaluation system.
How it connects
Connects automated evaluation with RAG, pytest, continuous integration, GitHub Actions, and expected-versus-generated answer comparison.

Also explained in

Compare how 23 books explain test-driven development →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Enterprise RAG. The section links point to the parts of the book it draws on.