The Screenplay Design Pattern

A Sustainable Way to Organize Complex Test Code

Michael Kutz

@MichaKutz

What is the screenplay pattern?

Why/when is it better then page objects?

What do I need to apply screenplay?

How can I transform my existing tests?

Is there an existing framework supporting screenplay?

Page Objects

Test

Elements

interacts with

Test

Test 2

interacts with

the same

By.name("username")
By.name("username")

Test

PageObject

Elements

Test 2

uses

uses

to interact with

By.name("username")
login(username, password)

Screenplay

Screenplay

Actor

Abilities

Tasks

Elements

Questions

Actions

Screen

enable

has

directs

asks

performs

made up of

interact with

about the state of

on a

Screenplay

(extended)

Screenplay

Actor

Abilities

Tasks

Elements

Questions

Actions

Screen

enable

has

directs

asks

performs

made up of

interact with

about the state of

on a

Facts

knows

req. for