chapter sixteen

16 Outline patterns that support higher-level steps

 

This chapter covers

  • Using hooks and tags to manage expensive resource initialization
  • Using dependency injection for simple resource management
  • Optimizing application state initialization
  • Reusing steps when their prerequisites are not explicit in a scenario
  • Expressing complicated expectations in a readable format
  • Atomic checking and clear reporting of complicated expectations

One of the core goals of formulation is to write concise, high-level scenarios that convey the intent of a scenario using steps that sketch the outline without exposing the mechanical details to the reader. But without the mechanical details there can be no automation, and the automation code must be easy to understand and maintain.

In theatre, the outline of a play includes the plot, the characters, and its narrative structure. Details, such as dialogue, scenery, or props, are omitted. The patterns described in this chapter use scenario automation tool functionality and Approval Testing concepts to efficiently automate BRIEF scenarios, even when working with expensive resources, complicated workflows, and complex outcomes:

16.1 Scenario Resource pattern: managing test resources

16.2 Context Shortcut pattern: bring the application to the expected state

16.3 Ensure pattern: managing implicit dependencies

16.4 Approved Outcome pattern: atomic handling of complex assertions

16.5 Summary