9 / 9 · Book 11 · Anatomy of a Test Case · drill: interview Q&A← prev⊞ allGet the book →
1.16Question 4
Prompt: Explain how you decide whether to use the traditional table format versus Given/When/Then for a test case. Give an example where each format is the better choice. What a strong answer should cover:
- Given/When/Then excels for BDD teams, concise scenarios, and readability
- Traditional table format suits regulated industries, detailed multi-step flows, and audit trails
- The choice depends on audience, tooling, and compliance requirements
- Both formats can coexist in the same project Example answer:
- I use Given/When/Then when the team practices BDD or when the scenario is a single user action with a clear outcome — for example, "GIVEN a cart with items, WHEN user applies a valid coupon, THEN the total decreases by the coupon amount." It is concise and readable by non-technical stakeholders
- I use the traditional table format when a regulated environment requires step-by-step audit evidence — for example, a healthcare flow where each step must be signed off: step 1 verify patient ID, step 2 confirm medication, step 3 check allergy list, step 4 approve prescription
- On mixed teams I often use Given/When/Then for the scenario summary and attach detailed steps as a sub-table for complex multi-step flows