chapter thirteen

13 Spotlight patterns for automating narrative flow

 

This chapter covers

  • Understanding the execution model of automated BDD scenarios
  • Techniques that support idiomatic natural language narrative
  • Using the scenario context as a memory
  • Exploring how entities are introduced and referenced in a scenario
  • Selecting entities programmatically from a collection

The patterns described in this chapter allow the focus of a scenario to be kept on those elements that are of the most importance, just like a spotlight is used to illuminate the star performer at a concert. For this reason, we call this the Spotlight pattern language:

  • The Local Scenario Context and Shareable Scenario Context patterns allow information to be shared between steps during scenario execution, eliminating the need for repetition within a scenario.
  • The Introduce and Refer pattern utilizes specific natural language phrases to distinguish the introduction of a new entity from a reference to an existing entity, enabling the use of idiomatic business language throughout a scenario.
  • The Entity Selector pattern describes an approach that uses domain logic to select an appropriate entity in response to idiomatic business language

13.1 The Local Scenario Context pattern: learning to remember

13.2 The Shareable Scenario Context pattern: sharing data between step definitions in different classes

13.3 The Introduce and Refer pattern: separating introduction and reference

13.3.1 What about “they”?

13.3.2 Referring to more than one entity?

13.4 The Entity Selector pattern: selecting entities by phrases

13.5 Summary