liveBook · Manning

Screenplay pattern

As explained in Effective Behavior-Driven Development

The Screenplay pattern is a test-automation design pattern that models actors, abilities, tasks, and questions to express interactions with a system.

The Screenplay pattern structures automated tests around actors pursuing goals through an application. It can be used beyond UI automation. section 15.8.2

The model names five parts of an actor’s test interactions:

  • Actors represent users or agents with goals. section 15.8.2
  • Abilities are the functions available to an actor in a given context. section 15.8.2
  • Tasks are higher-level business actions that help achieve goals. section 15.8.2
  • Interactions are lower-level activities used to complete tasks. section 15.8.2
  • Questions query system state so tests can make assertions. section 15.8.2

In BDD automation, scenario steps and their definitions resemble tasks; driver methods and test actions resemble interactions or questions. The pattern also offers a framework and terminology for thinking about code layering. section 15.8.2 section 15.9

Figure 15.9 The Screenplay pattern concepts are actors, abilities, tasks, interactions, and questions

A diagram summarizes the relationships among the five concepts. section 15.8.2

How Effective Behavior-Driven Development covers it

How deep it goes
Defines five concepts and relates them to BDD automation, while deferring detailed treatment of the pattern.
Examples
Illustrates the five-part model with a concept diagram, without a worked scenario.
What you can do after
Understand the five concepts and how they map to BDD automation layers.
How it connects
Connects the model to BDD, the page object pattern, infrastructure layers, and polymorphic drivers.

Also explained in

Compare how 2 books explain screenplay pattern →

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.