Parameterization Matrix (Scenario Outline & Examples)
You've mastered the grammar of a single scenario. Now the real world hits you with a feature that has six, eight, or twelve input variations — and copy-pasting Scenario: blocks stops being a technique and starts being a liability.
Why This Module Matters
Picture an age-validation rule: 18 is accepted, -5 is rejected, 17.9 is an error, "abc" is an error. Written the naive way, that's four nearly identical Scenario: blocks, each differing in exactly one value. The Given, When, and Then lines are copied four times over. The moment the rule changes — say the wording of the step, or an extra assertion — you're editing four places instead of one, and it's only a matter of time before one copy drifts out of sync with the others.
Gherkin has a built-in fix for exactly this shape of duplication: Scenario Outline combined with an Examples: table. Instead of four scenarios, you write the logic once with <placeholder> tokens standing in for the values that change, then supply every variation as a row in a table underneath. The Gherkin runner expands that single outline into one full scenario execution per row — same logic, different data, zero copy-paste.
What You'll Learn
- The
<placeholder>syntax: how angle-bracket tokens inside a step get substituted from a table column, and why they are not "variables" in the programming sense - The full anatomy of a
Scenario Outline:block and its pairedExamples:table, including the rule that every placeholder used in a step must have a matching column header - How to actually design the rows of an Examples table for real boundary-value coverage — not just a handful of arbitrary numbers
- How a well-built Scenario Outline + Examples table becomes a review artifact a BA can read and extend, and a specification a developer can implement against directly
Your Practice Challenge
After the lessons, you'll take on The Data Matrix — an interactive challenge built on a Scenario Outline for age validation. Four Examples: rows already show a fixed <age> value (18, -5, 17.9, "abc"); for each row you pick, from a dropdown, the correct <expected> outcome category (Accepted / Rejected / Error). Getting all four right in one submission unlocks "Full Coverage Matrix" — miss just one boundary and you'll discover a different outcome, down to "No Boundaries Covered" if you get every row wrong. Six outcomes total to find.