liveBook · Manning

Context

As explained in Software Testing with Generative AI

The relevant background information, constraints, and requirements provided to guide interpretation of a testing request.

Context is the relevant background, constraints, requirements, and system details supplied to guide an LLM toward useful testing or development output. General, context-free requests produce shallow responses; clear, specific context makes results more relevant and actionable. section 1.2.1 section 1.2.2

Useful context commonly includes:

  • The feature or behavior under test, its users, acceptance criteria, inputs, expected outcomes, and relevant quality characteristics. section 1.2.2
  • The specific task, such as generating test ideas, test data, risks, code snippets, or automation components, rather than an entire testing strategy. section 3.3.1
  • Project code, unit checks, implementation intent, or additional system details that let coding assistants refresh and improve their suggestions. section 4.4.3
  • Relevant external information retrieved selectively instead of supplying an entire codebase or an unnecessarily large prompt. section 10.1.2 section 11.4

From a generic request to a contextual prompt

“Create tests for a file upload feature” encourages generic checks. A stronger request identifies a paralegal document-upload feature, PDF/DOCX/TXT support, a 20MB limit, progress updates, uploader-only initial access, stored upload reports, and risks affecting functionality, data integrity, and security. The resulting suggestions can address the actual behavior instead of merely naming valid and invalid files. section 1.2.2 section 5.2.1

Context can be added incrementally by modeling a system, slicing it into focused behaviors, and iterating prompts. RAG combines relevant contextual data with a query; fine-tuning embeds context more directly into a model. Both improve alignment but introduce risks: retrieval can select inaccurate data, broad queries complicate selection, and generated interpretations still require human verification. section 5.3.1 section 10.2 section 11.4 section 8.2.1

Figure 1.1 A model outlining the three tenets of success with generative AI

Use the three-tenet model to relate context to mindset and technique when deciding how to obtain value from generative AI. section 1.2.1

How Software Testing with Generative AI covers it

How deep it goes
Explains contextual prompting, system slicing, retrieval, and fine-tuning, while stopping short of eliminating hallucinations or human verification.
Examples
Demonstrates file-upload testing, authorization-token risks, Copilot timesheet code, and modeled booking-report data.
What it assumes
Assumes familiarity with testing tasks and prompts while teaching how to express feature behavior, constraints, and system understanding from practical examples.
What you can do after
Evaluate and refine prompts, provide focused context, use retrieved information, and verify generated testing or development suggestions.
How it connects
Connects prompting, prompt engineering, testing, retrieval-augmented generation, fine-tuning, vector databases, and AI agents.

Also explained in

Compare how 18 books explain context →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Testing with Generative AI. The section links point to the parts of the book it draws on.