11 Scalable test automation with the Screenplay pattern
This chapter covers
- Actor-centric testing and the Screenplay pattern
- Modelling users using Screenplay Actors
- Interacting with the application with Screenplay Interactions
- Querying the state of the system with Abilities and Questions
- Grouping Interactions together to model higher level business tasks
- Integrating Screenplay code with Cucumber
As your test automation framework grows, you quickly realize that your biggest problem isn’t knowing how to automate each new scenario; it’s being able to add these new scenarios while at the same time keeping your code base simple and maintainable. As your test suite interacts with different UI components, APIs, databases and more, keeping your code simple and consistent can be harder and harder to do.
The Screenplay Pattern, which we will be covering in this chapter, is an approach to keeping this complexity under control as our frameworks grow. The Screenplay Pattern is an actor-centered approach to modelling executable specifications. It leverages functional composition to help you capture the domain language and represent the various workflows your system needs to support in a way that's easy to understand by both technical and non-technical audience