Modern QA2026Element 1: Context
Log inJoin
1 / 3 · Book 2 · The Anatomy of a Test-Generation Prompt · drill: interview Q&A⊞ allnext →Get the book →

1.3Element 1: Context

Context tells the LLM what kind of system it is dealing with. Without it, the LLM makes generic assumptions. With it, the LLM tailors its output to the technology stack, domain, and architecture.

What context includes:

  1. Technology stack -- language version, framework, runtime
  2. Architecture -- monolith vs microservices, sync vs async, REST vs GraphQL
  3. Domain -- e-commerce, healthcare, fintech, social media
  4. External dependencies -- payment processors, email services, file storage
  5. Data formats -- prices in cents vs dollars, dates in ISO 8601, UUIDs vs integers
  6. Authentication mechanism -- JWT, OAuth, API keys, session cookies

Weak context vs strong context:

Weak context:

Write tests for the checkout flow.

The AI does not know:

  • What language or framework you use
  • What the checkout flow involves
  • What external services are called
  • How prices are represented
  • How authentication works

Strong context:

We have an e-commerce checkout API built in Node.js 20 with Express 4.
The checkout flow involves:
1. Cart validation (check stock availability via inventory service)
2. Payment processing via Stripe API (test mode)
3. Order creation in PostgreSQL via Prisma ORM
4. Email confirmation via SendGrid

The API is behind JWT authentication (customer role required).
All prices are stored as integers (cents). A $29.99 item is stored as 2999.
The cart maximum is 50 items. Minimum order value is $1.00 (100 cents).

The strong context tells the LLM about the tech stack, the business flow, the external dependencies, the data format, and the auth mechanism. This eliminates entire classes of hallucination.

Context depth by test type:

Test Type Context Depth Needed Key Context Items
Unit test Low Function signature, input/output types, business rules
Integration test Medium Endpoint details, database schema, external service contracts
E2E test High Full user flow, UI components, navigation, auth flow
Performance test Medium Expected throughput, SLAs, infrastructure details
Security test High Auth mechanism, data sensitivity, compliance requirements

Pro Tip: When in doubt about how much context to include, err on the side of more rather than less. You can always reduce context in subsequent iterations if the output is already good. But recovering from missing context requires a full regeneration.