Glossary term
Retrieval-augmented generation (RAG)
Retrieval-augmented generation, or RAG, is an AI pattern that fetches relevant documents from a knowledge source and passes them to a language model to ground its answer. Testing RAG means checking both the retrieval step and the generated answer, with metrics such as context precision and faithfulness.
How a RAG system works
- Documents are split into chunks and stored, usually as embeddings in a vector database.
- For each question, a retriever finds the most relevant chunks.
- The model writes an answer using those chunks as context.
What to test in a RAG app
- Retrieval: did it fetch the right chunks? Metrics such as context precision and context recall measure this.
- Grounding: does the answer stick to the retrieved text? That is faithfulness.
- Relevance: does it answer the actual question? See answer relevancy.
Testing the two halves separately tells you whether to fix the search step or the prompt.
Read the full guide: What Is RAGAS — Testing RAG Pipelines Explained for QA Engineers
More terms
Agentic testingAI hallucinationAI red teamingAnswer relevancyAPI testingBehaviour-driven development (BDD)CI quality gateContext precisionEnd-to-end testingExploratory testingFaithfulnessFlaky testGolden datasetIntegration testingJailbreakLLM evaluationLLM guardrailsLLM-as-a-judgeLoad testingModel Context Protocol (MCP)OWASP Top 10 for LLM ApplicationsPage Object ModelPrompt injectionRegression testingSDETSelf-healing testsSmoke testingTest automationTest caseTest pyramidVisual regression testing
