SlideShare a Scribd company logo
@Wakaleo @JanMolak#SerenityBDD
Screenplay

Next generation automated
acceptance testing
AUTHOR OF ‘BDD IN ACTION’
@wakaleo
www.johnfergusonsmart.com
@Wakaleo @JanMolak#SerenityBDD
Sustainable test automation
to deliver features that matter
@Wakaleo @JanMolak#SerenityBDD
Learn
Measure
Build
@Wakaleo @JanMolak#SerenityBDD
Requirements
Discovery
Automation and
Feedback
Software
Craftsmanship
Learn Build
Measure
@Wakaleo @JanMolak#SerenityBDD
Requirements
Discovery
Automation and
Feedback
Software
Craftsmanship
Learn Build
Measure
@Wakaleo @JanMolak#SerenityBDD
source:
- 44% - “Out of Control - Why Control Systems Go Wrong and How to Prevent Failure”
- 56% - “An Information Systems Manifesto”
- 80% - “Requirements: A quick and inexpensive way to improve testing”
44-80%of all defects are caused by unclear,
ambiguous or incorrect requirements
@Wakaleo @JanMolak#SerenityBDD
Behaviour-Driven Development
@Wakaleo @JanMolak#SerenityBDD
Behaviour-Driven Development
Domain-Driven Design
@Wakaleo @JanMolak#SerenityBDD
Domain-Driven Design
Behaviour-Driven Development
User-Centred Design
@Wakaleo @JanMolak#SerenityBDD
Building the
application
Testing the
application
When we are…
We model…
The domain
How the user interacts
with the application
Account
Purchase
Product
Open an account
Look for a
product
Completes a
purchase
NOUNS VERBS
The key
concepts
are…
@Wakaleo @JanMolak#SerenityBDD #Devoxx
HOW
Enter the value ‘Get a
coffee’



Click on TAB
WHAT
Record a todo item
WHY
Keep a list of things I need
to do
@Wakaleo @JanMolak#SerenityBDD
Actors
Goals
Tasks
Interactions
System
have
involve
require
with the
Focus on
outstanding
items
@Wakaleo @JanMolak#SerenityBDD
Actor Goals Tasks Interactions
Press “Enter”
Type “Walk the dog”
Record things
I need to do
Mark as complete
Record an item
Filter the list
@Wakaleo @JanMolak#SerenityBDD
Feature:	Filter	the	list	to	find	items	of	interest



		In	order	to	focus	on	outstanding	items

		James	would	like	to	filter	his	todo	list	

		to	only	show	items	of	interest	
		Scenario:	Viewing	Active	items	only



		Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee

				And	he	completes	Walk	the	dog

			When	he	filters	his	list	to	show	only	Active	tasks

			Then	his	todo	list	should	contain	Get	a	coffee
@Wakaleo @JanMolak#SerenityBDD
Feature:	Filter	the	list	to	find	items	of	interest



		In	order	to	focus	on	outstanding	items	
		James	would	like	to	filter	his	todo	list		
		to	only	show	items	of	interest	
		Scenario:	Viewing	Active	items	only	
		Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
				And	he	completes	Walk	the	dog

			When	he	filters	his	list	to	show	only	Active	tasks

			Then	his	todo	list	should	contain	Get	a	coffee
Actor
@Wakaleo @JanMolak#SerenityBDD
Feature:	Filter	the	list	to	find	items	of	interest

		In	order	to	focus	on	outstanding	items	
		James	would	like	to	filter	his	todo	list	

		to	only	show	items	of	interest	
		Scenario:	Viewing	Active	items	only	


		Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee

				And	he	completes	Walk	the	dog

			When	he	filters	his	list	to	show	only	Active	tasks

			Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
			And	he	completes	Walk	the	dog

		When	he	filters	his	list	to	show	only	Active	tasks

		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

	Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
			And	he	completes	Walk	the	dog	
		When	he	filters	his	list	to	show	only	Active	tasks

		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

	Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
			And	he	completes	Walk	the	dog	
		When	he	filters	his	list	to	show	only	Active	tasks	
		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

	Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
			And	he	completes	Walk	the	dog	
		When	he	filters	his	list	to	show	only	Active	tasks	
		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

	Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
			And	he	completes	Walk	the	dog	
		When	he	filters	his	list	to	show	only	Active	tasks	
		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
			And	he	completes	Walk	the	dog

		When	he	filters	his	list	to	show	only	Active	tasks

		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Start	with	a	list	containing:	Walk	the	dog,	Get	a	coffee	
			And	he	completes	Walk	the	dog	
		When	he	filters	his	list	to	show	only	Active	tasks	
		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Start	with	a	list	containing:	Walk	the	dog,	Get	a	coffee	
			And	he	completes	Walk	the	dog	
		When	he	filters	his	list	to	show	only	Active	tasks

		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Start	with	a	list	containing:	Walk	the	dog,	Get	a	coffee	
Complete	a	todo	item	called:	Walk	the	dog	
		When	he	filters	his	list	to	show	only	Active	tasks

		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Start	with	a	list	containing:	Walk	the	dog,	Get	a	coffee	
Complete	a	todo	item	called:	Walk	the	dog	
		When	he	filters	his	list	to	show	only	Active	tasks	
		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Start	with	a	list	containing:	Walk	the	dog,	Get	a	coffee	
Complete	a	todo	item	called:	Walk	the	dog	
Filter	list	to	show	only	Active	tasks	
		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Start	with	a	list	containing:	Walk	the	dog,	Get	a	coffee	
Complete	a	todo	item	called:	Walk	the	dog	
Filter	list	to	show	only	Active	tasks	
		Then	his	todo	list	should	contain	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Start	with	a	list	containing:	Walk	the	dog,	Get	a	coffee	
Complete	a	todo	item	called:	Walk	the	dog	
Filter	list	to	show	only	Active	tasks	
Expect	to	see:	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Start	with	a	list	containing:	Walk	the	dog,	Get	a	coffee	
Complete	a	todo	item	called:	Walk	the	dog	
Filter	list	to	show	only	Active	tasks	
Expect	to	see:	Get	a	coffee
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
Scenario:	Viewing	Active	items	only

Start	with	a	list	containing:	Walk	the	dog,	Get	a	coffee	
		Open	browser	on	‘todomvc.com/examples/angularjs/'	
		Resize	browser	window	to	maximum	
		Add	a	todo	item	called	‘Walk	the	dog’	
		Add	a	todo	item	called	‘Get	a	coffee’	
...
Actor
Goals
Tasks
@Wakaleo @JanMolak#SerenityBDD
To	view	Active	items	only,	James	attempts	to:

Start	with	a	list	containing:	Walk	the	dog,	Get	a	coffee	
		Open	browser	on	‘todomvc.com/examples/angularjs/'	
		Resize	browser	window	to	maximum	
		Add	a	todo	item	called	‘Walk	the	dog’	
		Add	a	todo	item	called	‘Get	a	coffee’	
				Enter	the	value	‘Get	a	coffee’	
				Hit	the	Enter	key	
...
Actor
Goals
Tasks
Interactions
Software
Craftsmanship
Automation and
Feedback
@Wakaleo @JanMolak#SerenityBDD
Requirements
Discovery
Learn Build
Measure
@Wakaleo @JanMolak#SerenityBDD
40-70%maintenance overhead for poorly-written test suites
@Wakaleo @JanMolak#SerenityBDD
Serenity BDD
and the Screenplay Pattern
@Wakaleo @JanMolak#SerenityBDD
Complete the requirements circle
Serenity BDD and the Screenplay Pattern
@Wakaleo @JanMolak#SerenityBDD
Serenity BDD and the Screenplay Pattern
User-centric
@Wakaleo @JanMolak#SerenityBDD
Serenity BDD and the Screenplay Pattern
Reusable business DSL…in code
@Wakaleo @JanMolak#SerenityBDD
Serenity BDD and the Screenplay Pattern
Designed to scale
@Wakaleo @JanMolak#SerenityBDD
Serenity BDD
and the Screenplay Pattern
in action
Focus on
outstanding
items
@Wakaleo @JanMolak#SerenityBDD
Actor Goals Tasks Interactions
Press “Enter”
Type “Walk the dog”
Mark as complete
Record an item
Filter the list
Record things
I need to do
@Wakaleo @JanMolak#SerenityBDD
		Actor	james	=	Actor.named(“James”);	actor
@Wakaleo @JanMolak#SerenityBDD
		@Managed	WebDriver	hisBrowser;	
		…	
		

		james.can(BrowseTheWeb.with(hisBrowser));	
an actor
has
abilities
@Wakaleo @JanMolak#SerenityBDD
		james.attemptsTo(

						AddATodoItem.called("Buy	some	milk")

		);	
an actor
performs
tasks
@Wakaleo @JanMolak#SerenityBDD
	@Given(“^.*	has	a	todo	list	containing	(.*)$")

	public	void	has_a_list_with(List<String>	items)	{	
				james.attemptsTo(	
								Start.withATodoListContaining(items)	
				);

	}	
an actor
performs
tasks
@Wakaleo @JanMolak#SerenityBDD
public	class	Start	implements	Task	{



		@Step("{0}	starts	with	#items")

		public	<T	extends	Actor>	void	performAs(T	actor)	{

					actor.attemptsTo(	
									Open.browserOn().the(applicationHomePage),

									AddTodoItems.called(items))	
					);

		}	
		//	...	
}
tasks
can use
other
tasks
@Wakaleo @JanMolak#SerenityBDD
public	class	AddATodoItem	implements	Task	{



		@Step("{0}	adds	a	todo	item	called:	#thingToDo")

		public	void	performAs(Actor	theActor)	{

						theActor.attemptsTo(

										Enter.theValue(thingToDo)

															.into(TodoList.WHAT_NEEDS_TO_BE_DONE)

															.thenHit(RETURN)

						);

		}	
		//	...	

}
tasks
use
inter-
actions
@Wakaleo @JanMolak#SerenityBDD
public class TodoList {
public static Target WHAT_NEEDS_TO_BE_DONE = Target.the("'What needs to be done?' field")
.locatedBy(“#new-todo");
public static Target ITEMS = Target.the("List of todo items")
.locatedBy(".view label");
public static Target ITEMS_LEFT = Target.the("Count of items left")
.locatedBy("#todo-count strong”);
public static Target FILTER = Target.the("filter")
.locatedBy("//*[@id='filters']//a[.='{0}']");
}
Page
Objects
are much
simpler
Automation and
Feedback
@Wakaleo @JanMolak#SerenityBDD
Requirements
Discovery
Software
Craftsmanship
Learn Build
Measure
@Wakaleo @JanMolak#SerenityBDD
Levels of communication
-
+
@Wakaleo @JanMolak#SerenityBDD
10,000 ft

Release Readiness
-
+
@Wakaleo @JanMolak#SerenityBDD
1000 ft

Capabilities and Features
-
+
@Wakaleo @JanMolak#SerenityBDD
100 ft

Scenarios and Steps
-
+
Focus on
outstanding
items
@Wakaleo @JanMolak#SerenityBDD
Actor Goals Capabilities Features
Keeping the
list up to date
Mark as
complete
Record an
item
Remove an
item
Focus on
important
tasks
Scenarios
Complete a
todo item
@Wakaleo @JanMolak#SerenityBDD
Release
Readiness
-
+
-
+
@Wakaleo @JanMolak#SerenityBDD
Release
Readiness
Capabilities
-
+
@Wakaleo @JanMolak#SerenityBDD
Release
Readiness
Capabilities
Features
-
+
@Wakaleo @JanMolak#SerenityBDD
Release
Readiness
Capabilities
Features
Scenarios
@Wakaleo @JanMolak#SerenityBDD
‣ “Page Objects Refactored: SOLID Steps to the Screenplay/
Journey Pattern” - DZone 

Antony Marcano, Andy Palmer, Jan Molak, John Ferguson Smart 

bit.ly/screenplay-page-objects
‣ “Beyond Page Objects: Next Generation Test Automation
with Serenity and the Screenplay Pattern” - InfoQ

John Ferguson Smart, Antony Marcano, Andy Palmer, Jan Molak
bit.ly/screenplay-introduction
Want to know more?
@Wakaleo @JanMolak#SerenityBDD
Want to know more?
Learn about Serenity:

serenity-bdd.info
Learn more about BDD and Serenity, and how we can help:

http://johnfergusonsmart.com
See the project in action:

bit.ly/screenplay-jvm-demo
@Wakaleo @JanMolak#SerenityBDD
Questions?
AUTHOR OF ‘BDD IN ACTION’
@wakaleo
www.johnfergusonsmart.com

More Related Content

PDF
【Unite Tokyo 2019】SRPで一から描画フローを作ってみた! ~Unity描画フローからの脱却~
PDF
Succeeding with Agile
PDF
ビジネスとデザイナーの役割りの話
PDF
50.000 orange stickies later
PDF
KMM - Modelo de Maturidade Kanban - v.1.1 (Pt-br)
PDF
Practical estimation techniques
PDF
Why do all my ddd apps look the same - Vienna 2014
PDF
Understanding Agile Hardware
【Unite Tokyo 2019】SRPで一から描画フローを作ってみた! ~Unity描画フローからの脱却~
Succeeding with Agile
ビジネスとデザイナーの役割りの話
50.000 orange stickies later
KMM - Modelo de Maturidade Kanban - v.1.1 (Pt-br)
Practical estimation techniques
Why do all my ddd apps look the same - Vienna 2014
Understanding Agile Hardware

Similar to Screenplay - Next generation automated acceptance testing (20)

PDF
Serenity/JS - next generation acceptance testing for modern web applications
PDF
BDD in Action – principles, practices and real-world application
PDF
Successfully Implementing BDD in an Agile World
PDF
Mastering BDD - Eran Kinsbruner Workshop Quest 2018
PDF
It's Testing, Jim, but not as we know it - BDD for Testers
PDF
BDD in Action - Devoxx 2014
PDF
Behavior Driven Development—A Guide to Agile Practices
ODP
Moving to tdd bdd
PDF
Making the Move to Behavior-Driven Development
PPTX
Behavior-Driven Development (BDD) in context
PPTX
Free from the shackles of TDD
PDF
Expo qa from user stories to automated acceptance tests with bdd
PDF
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
PPTX
BEHAVIOR-DRIVEN-DEVELOPMENT.pptx
PDF
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
PDF
Whole team approach to agile testing bdd can help better pune 15th meetup
PPTX
Design your tests to behave - An introduction To BDD!
PPTX
Behavioral driven development the compelling story For Testers
PDF
Contrasting test automation and BDD - 2020
PPTX
Behavior-Driven Development (BDD) and Its Impact on Software Testing.pptx
Serenity/JS - next generation acceptance testing for modern web applications
BDD in Action – principles, practices and real-world application
Successfully Implementing BDD in an Agile World
Mastering BDD - Eran Kinsbruner Workshop Quest 2018
It's Testing, Jim, but not as we know it - BDD for Testers
BDD in Action - Devoxx 2014
Behavior Driven Development—A Guide to Agile Practices
Moving to tdd bdd
Making the Move to Behavior-Driven Development
Behavior-Driven Development (BDD) in context
Free from the shackles of TDD
Expo qa from user stories to automated acceptance tests with bdd
Webinar-From user stories to automated acceptance tests with BDD-Eduardo Riol
BEHAVIOR-DRIVEN-DEVELOPMENT.pptx
Behavior Driven Development—A Guide to Agile Practices by Josh Eastman
Whole team approach to agile testing bdd can help better pune 15th meetup
Design your tests to behave - An introduction To BDD!
Behavioral driven development the compelling story For Testers
Contrasting test automation and BDD - 2020
Behavior-Driven Development (BDD) and Its Impact on Software Testing.pptx
Ad

More from John Ferguson Smart Limited (20)

PPTX
My Reading Specs - Refactoring Patterns for Gherkin Scenarios
PDF
Artisti e Condotierri - How can your team become artists of the 21st century ...
PDF
Engage! Bringing teams together to deliver software that makes a difference
PDF
BE A POD OF DOLPHINS, NOT A DANCING ELEPHANT
PDF
Sustainable Test Automation with Serenity BDD and Screenplay
PDF
Feature Mapping Workshop
PDF
Engage! Bringing teams together to deliver software that makes a difference
PDF
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
PDF
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
PDF
Shift left-devoxx-pl
PDF
Cucumber and Spock Primer
PDF
All the world's a stage – the next step in automated testing practices
PDF
CukeUp 2016 Agile Product Planning Workshop
PDF
BDD Anti-patterns
PDF
Serenity and the Journey Pattern
PDF
BDD - Collaborate like you mean it!
PDF
BDD-Driven Microservices
PDF
BDD Anti-patterns
PDF
BDD in Action - Automated Web Testing with WebDriver and Serenity
PDF
BDD in Action: Building Software Right and Building the Right Software
My Reading Specs - Refactoring Patterns for Gherkin Scenarios
Artisti e Condotierri - How can your team become artists of the 21st century ...
Engage! Bringing teams together to deliver software that makes a difference
BE A POD OF DOLPHINS, NOT A DANCING ELEPHANT
Sustainable Test Automation with Serenity BDD and Screenplay
Feature Mapping Workshop
Engage! Bringing teams together to deliver software that makes a difference
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Beyond Given/When/Then - why diving into Cucumber is the wrong approach to ad...
Shift left-devoxx-pl
Cucumber and Spock Primer
All the world's a stage – the next step in automated testing practices
CukeUp 2016 Agile Product Planning Workshop
BDD Anti-patterns
Serenity and the Journey Pattern
BDD - Collaborate like you mean it!
BDD-Driven Microservices
BDD Anti-patterns
BDD in Action - Automated Web Testing with WebDriver and Serenity
BDD in Action: Building Software Right and Building the Right Software
Ad

Recently uploaded (20)

PDF
Building Integrated photovoltaic BIPV_UPV.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
PDF
Approach and Philosophy of On baking technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
Building Integrated photovoltaic BIPV_UPV.pdf
The AUB Centre for AI in Media Proposal.docx
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
MIND Revenue Release Quarter 2 2025 Press Release
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
cuic standard and advanced reporting.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Encapsulation_ Review paper, used for researhc scholars
Programs and apps: productivity, graphics, security and other tools
sap open course for s4hana steps from ECC to s4
Digital-Transformation-Roadmap-for-Companies.pptx
Chapter 3 Spatial Domain Image Processing.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx
Approach and Philosophy of On baking technology
Review of recent advances in non-invasive hemoglobin estimation

Screenplay - Next generation automated acceptance testing