liveBook · Manning

Test recipe

As explained in The Art of Unit Testing 3e

A test recipe is a prescribed sequence of setup, execution, and verification steps for running a test scenario.

A test recipe is a short, informal plan for testing one feature. It lists the happy path and meaningful edge cases, then assigns each scenario to the test level that gives enough confidence without unnecessary cost. Rather than requiring every scenario at every level, it helps balance fast lower-level tests with a few high-level checks where they matter. section 10.3 section 10.3.3

Write the recipe just before implementation, preferably with another person who brings a different testing perspective. Keep it near the feature story or TODO item, treat it as part of done, and revise it as the work reveals missing or unnecessary scenarios. It is a working comment, not a formal stakeholder promise or a separate test-management artifact. section 10.3.1 section 10.3.2

A practical recipe should:

  • Name simple automated scenarios, including the main path and significant variations. section 10.3
  • Prefer lower-level tests for fast feedback; use higher-level tests when they are needed for confidence. section 10.3.3
  • Avoid duplicating a scenario already covered by another feature or test layer. section 10.3.3
  • Aim for confidence rather than uniformity: a feature may need only unit tests, only API or E2E tests, or a mix. section 10.3.3
  • Coordinate changes with the person who helped create the recipe. section 10.3.3

Profile update recipe

A profile feature can have one E2E check that logs in, updates an email, logs out, logs back in, and verifies the change. An API test can send more complicated update data. Unit tests can cover invalid email, an unchanged email, and serialization or deserialization. The high-level test proves the key flow; lower-level tests exercise variations more quickly. section 10.3.1 section 10.3.3

Recipes prevent two opposite mistakes: relying only on low-level tests, which may not establish that the feature works as a whole, and accumulating many E2E tests, whose added value can be low while maintenance remains costly. A useful rule of thumb is substantially more lower-level tests than high-level ones, but the deciding question is whether passing the recipe would make the team feel reasonably confident. section 10.3.3 section 10.5

User profile feature testing recipe
 
E2E - Login, go to profile screen, update email, log out, log in with new email, verify profile screen updated
 
API - Call UpdateProfile API with more complicated data
Unit test - Check profile update logic with bad email
Unit test - Profile update logic with same email
Unit test - Profile serialization/deserialization

Use this compact profile-update listing as a model for recording scenarios and their assigned levels in a feature story. section 10.3.1

How The Art of Unit Testing 3e covers it

How deep it goes
Gives creation timing, collaboration guidance, level-selection rules, ratios, and revision practices rather than implementation details.
Examples
Uses a user-profile update flow with E2E, API, and unit scenarios for email validation and serialization.
What it assumes
Starts with informal scenario planning and does not require a separate test-planning tool.
What you can do after
Apply it by drafting and revising a 5–20-line automated scenario plan that balances confidence, speed, and maintenance.
How it connects
Connects happy paths, edge cases, unit tests, API tests, E2E tests, TDD, and feature toggles.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of Unit Testing 3e. The section links point to the parts of the book it draws on.