liveBook · Manning

Parameterized scenario pattern

As explained in Effective Behavior-Driven Development

A scenario pattern that uses configurable values or notation to specify and verify behavior across different deployment configurations.

A parameterized scenario marks deployment-dependent details with placeholders, so the same behavior can be specified and verified using values for different configurations. section 20.4 section 20.5

Listing 20.5 Price calculation for multi-country deployment
*** Features/Pricing.feature ***
Scenario: Price calculation
  Given the net price of the Margherita pizza is [CUR]8    #A
  When the price of 3 Margherita pizzas are calculated
  Then the sum net price is [CUR]24    #A
  And the sales tax is [TAX] percent    #B

The pizza pricing scenario uses [CUR] for currency and [TAX] for tax, leaving country-specific values to configuration. section 20.4

Use the pattern to keep configurable requirements clear:

  • Identify which scenario details vary by deployment and mark them with placeholders. section 20.4
  • Resolve placeholder values from test configuration when the scenario executes. section 20.5

How Effective Behavior-Driven Development covers it

How deep it goes
Defines scenario placeholders and shows custom parameter types resolving values for automation code.
Examples
Uses multi-country pizza pricing, with configurable currency symbols and sales-tax values.
What it assumes
Assumes scenarios and test configuration settings exist, and that deployment-specific requirements identify which scenario details vary.
What you can do after
Apply it by marking deployment-dependent scenario details with placeholders and resolving them from test configuration during execution.
How it connects
Distinguishes the pattern from Parameterized Execution and connects it to test configuration settings and software factories.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Behavior-Driven Development. The section links point to the parts of the book it draws on.