SlideShare a Scribd company logo
@JanMolak @Wakaleo#Devoxx #SerenityJS
@JanMolak @Wakaleo#Devoxx #SerenityJS
@JanMolak @Wakaleo#Devoxx #SerenityJS
Jan Molak, John Smart:
Next Generation
Acceptance Testing
@JanMolak @Wakaleo#Devoxx #SerenityJS
acceptance tests that help deliver‹
working software
that matters
@JanMolak @Wakaleo#Devoxx #SerenityJS
what’s the root cause of‹
most software
defects?
@JanMolak @Wakaleo#Devoxx #SerenityJS
ambiguous,
unclear
and incorrect‹
requirements
@JanMolak @Wakaleo#Devoxx #SerenityJS
44-80%‹
of all software defects
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”
@JanMolak @Wakaleo#Devoxx #SerenityJS
Behaviour-Driven Development
@JanMolak @Wakaleo#Devoxx #SerenityJS
Domain-Driven Design
Behaviour-Driven Development
@JanMolak @Wakaleo#Devoxx #SerenityJS
User-Centred Design
Domain-Driven Design
Behaviour-Driven Development
@JanMolak @Wakaleo#Devoxx #SerenityJS
reliable
scalable
actionable
acceptance tests that are:
@JanMolak @Wakaleo#Devoxx #SerenityJS
example
feature → scenario
@JanMolak @Wakaleo#Devoxx #SerenityJS
	Feature:	Filter	the	list	to	find	items	of	interest‹
‹
			In	order	to	limit	the	cognitive	load‹
			James	would	like	to	filter	his	todo	list	‹
			to	only	show	items	of	interest‹
@JanMolak @Wakaleo#Devoxx #SerenityJS
	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
@JanMolak @Wakaleo#Devoxx #SerenityJS
automation, take #1
“a test script”
@JanMolak @Wakaleo#Devoxx #SerenityJS
		
	Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
	——————————————————————————————————————————————————————	
	this.Given(/^.*has	a	list	with	(.*)$/,	(items,	done)	=>	{	
			done();‹
	});
@JanMolak @Wakaleo#Devoxx #SerenityJS
	Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
	——————————————————————————————————————————————————————	
	this.Given	(/^.*has	a	list	with	(.*)$/,	(items,	done)	=>	{	
		browser.get('http://todomvc.com/examples/angularjs/');‹
		items.split(‘,’).forEach(item	=>	{‹
						element(by.id(‘new-todo’)).‹
										sendKeys(item);‹
						element(by.id(‘new-todo’)).‹
										sendKeys(protractor.Key.ENTER);‹
		});	
		done();‹
	});
@JanMolak @Wakaleo#Devoxx #SerenityJS
	Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
	——————————————————————————————————————————————————————	
	this.Given	(/^.*has	a	list	with	(.*)$/,	(items,	done)	=>	{	
		browser.get('http://todomvc.com/examples/angularjs/');‹
		items.split(‘,’).forEach(item	=>	{‹
						element(by.id(‘new-todo’)).‹
										sendKeys(item);‹
						element(by.id(‘new-todo’)).‹
										sendKeys(protractor.Key.ENTER);‹
		});	
		done();‹
	});
@JanMolak @Wakaleo#Devoxx #SerenityJS
automation, take #2
“a re-structured ‹
test script”
@JanMolak @Wakaleo#Devoxx #SerenityJS
	Given	James	has	a	list	with	Walk	the	dog,	Get	a	coffee	
	——————————————————————————————————————————————————————	
	this.Given	(/^.*has	a	list	with	(.*)$/,	(items,	done)	=>	{	
			let	todoList	=	new	TodoListPage();	
			todoList.get();‹
			items.split(‘,’).forEach(item	=>	{‹
							todoList.add(item);	
			});	
			done();‹
	});
@JanMolak @Wakaleo#Devoxx #SerenityJS
class	TodoListPage	{‹
				get	()	{	
								browser.get('http://todomvc.com/examples/angularjs/');	
				}‹
‹
				add	(item:	string)	{‹
								element(by.id(‘new-todo’)).sendKeys(item);‹
								element(by.id('new-todo')).sendKeys(protractor.Key.ENTER);‹
				}‹
‹
				complete	(item:	string)	{	
								element(by.xpath(	
										'//*[@class="view"	and	contains(.,"'	+	item	+	'")]'	+	‹
										'//input[@type="checkbox"]'‹
								)).click();	
				}	
				//	
‹
}
@JanMolak @Wakaleo#Devoxx #SerenityJS
class	TodoListPage	{‹
				get	()	{	
								browser.get('http://todomvc.com/examples/angularjs/');	
				}‹
‹
				add	(item:	string)	{‹
								element(by.id(‘new-todo’)).sendKeys(item);‹
								element(by.id('new-todo')).sendKeys(protractor.Key.ENTER);‹
				}‹
‹
				complete	(item:	string)	{	
								element(by.xpath(	
										'//*[@class="view"	and	contains(.,"'	+	item	+	'")]'	+	‹
										'//input[@type="checkbox"]'‹
								)).click();	
				}	
				//	
‹
}
@JanMolak @Wakaleo#Devoxx #SerenityJS
automation, take #3
“a screenplay”
@JanMolak @Wakaleo#Devoxx #SerenityJS
hierarchical task analysis
@JanMolak @Wakaleo#Devoxx #SerenityJS
hierarchical task analysis
actor
@JanMolak @Wakaleo#Devoxx #SerenityJS
hierarchical task analysis
goal
@JanMolak @Wakaleo#Devoxx #SerenityJS
hierarchical task analysis
tasks
@JanMolak @Wakaleo#Devoxx #SerenityJS
hierarchical task analysis
interactions
@JanMolak @Wakaleo#Devoxx #SerenityJS
Feature:	Filter	the	list	to	find	items	of	interest‹
‹
		In	order	to	limit	the	cognitive	load‹
		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
@JanMolak @Wakaleo#Devoxx #SerenityJS
Feature:	Filter	the	list	to	find	items	of	interest‹
‹
		In	order	to	limit	the	cognitive	load‹
		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
@JanMolak @Wakaleo#Devoxx #SerenityJS
Feature:	Filter	the	list	to	find	items	of	interest‹
‹
		In	order	to	limit	the	cognitive	load‹
		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
goal
@JanMolak @Wakaleo#Devoxx #SerenityJS
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
goal
tasks
@JanMolak @Wakaleo#Devoxx #SerenityJS
To	view	Active	items	only,	James	attempts	to:‹
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
goal
tasks
@JanMolak @Wakaleo#Devoxx #SerenityJS
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’	
...
actor
goal
tasks
@JanMolak @Wakaleo#Devoxx #SerenityJS
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
goal
tasks
inter-‹
actions
@JanMolak @Wakaleo#Devoxx #SerenityJS
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	
...
@JanMolak @Wakaleo#Devoxx #SerenityJS
To	view	Active	items	only,	James	attempts	to:‹
Start.withATodoListContaining(‘Walk	the	dog’,	
)	
		Open.browserOn(‘todomvc.com/examples/angularjs/’)	
		ResizeBrowserWindow.toMaximum()	
		AddATodoItem.called(‘Walk	the	dog’)	
		AddATodoItem.called(‘Get	a	coffee’)	
				Enter.theValue(‘Get	a	coffee’)‹
									.into(TodoList.New_Todo_Field)	
									.thenHit(protractor.Key.Enter)
@JanMolak @Wakaleo#Devoxx #SerenityJS
To	view	Active	items	only,	James	attempts	to:‹
Start.withATodoListContaining(‘Walk	the	dog’,	
)	
		Open.browserOn(‘todomvc.com/examples/angularjs/’)	
		ResizeBrowserWindow.toMaximum()	
		AddATodoItem.called(‘Walk	the	dog’)	
		AddATodoItem.called(‘Get	a	coffee’)	
				Enter.theValue(‘Get	a	coffee’)‹
									.into(TodoList.New_Todo_Field)	
									.thenHit(protractor.Key.Enter)
@JanMolak @Wakaleo#Devoxx #SerenityJS
Serenity/JS
Screenplay Pattern
@JanMolak @Wakaleo#Devoxx #SerenityJS
	let	james	=	Actor.named(‘James’);	actor
@JanMolak @Wakaleo#Devoxx #SerenityJS
	let	james	=	Actor.named(‘James’).whoCan(	
				BrowseTheWeb.using(protractor.browser)	
	);	
actor
has
abilities
@JanMolak @Wakaleo#Devoxx #SerenityJS
	james.attemptsTo(‹
					Start.withATodoListContaining(items)‹
	);	
actor
performs
tasks
@JanMolak @Wakaleo#Devoxx #SerenityJS
	this.Given	(/^.*has	a	list	with	(.*)$/,	(items)	=>	{	
			return	james.attemptsTo(‹
					Start.withATodoListContaining(items)‹
			);	
	});	
actor
performs
tasks
@JanMolak @Wakaleo#Devoxx #SerenityJS
export	class	Start	implements	Task	{	
‹
		performAs(actor:	PerformsTasks):	PromiseLike<void>	{	
				return	actor.attemptsTo(‹
						Open.browserOn('/examples/angularjs/'),‹
						ResizeBrowserWindow.toMaximum(),‹
						AddTodoItems.called(this.initialItems)‹
				);‹
		}	‹
}
tasks
consist of
tasks
@JanMolak @Wakaleo#Devoxx #SerenityJS
export	class	AddATodoItem	implements	Task	{	
‹
		performAs(actor:	PerformsTasks):	PromiseLike<void>	{‹
				return	actor.attemptsTo(‹
						Enter.theValue(‘Walk	the	dog’)‹
										.into(TodoList.New_Todo_Field),	
						Hit.the(protractor.Key.Enter)‹
										.into(ToDoList.New_Todo_Field)‹
);
}‹
}
tasks
consist of
inter-
actions
@JanMolak @Wakaleo#Devoxx #SerenityJS
export	class	AddATodoItem	implements	Task	{	
		@step('{0}	adds	a	todo	item	called	"#name"')‹
		performAs(actor:	PerformsTasks):	PromiseLike<void>	{‹
				//	
	
		}	
		constructor(private	name:	string)	{‹
		}	
}
tasks
can be
annotated
@JanMolak @Wakaleo#Devoxx #SerenityJS
to create
powerful
reports
@JanMolak @Wakaleo#Devoxx #SerenityJS
lights, camera,‹
Demo!
@JanMolak @Wakaleo#Devoxx #SerenityJS
github.com/jan-molak/serenity-js

More Related Content

PPTX
Continuous Acceleration with a Software Supply Chain Approach
PDF
The Rationale for Continuous Delivery (The culture and practice of good softw...
PDF
What you need to know to hire top developers in 2018 by Devskiller
PPTX
Manual de utilizaciĂłn de SlideShare
PDF
IntroduciĂłn a Dropbox
PPT
Telecollaborative games for youngsters: impact on motivation
PPTX
Teaching languages for specific purposes in a dynamic digital era: The power...
PDF
IntroduciĂłn a Gmail para profesorado da Xunta de Galicia
Continuous Acceleration with a Software Supply Chain Approach
The Rationale for Continuous Delivery (The culture and practice of good softw...
What you need to know to hire top developers in 2018 by Devskiller
Manual de utilizaciĂłn de SlideShare
IntroduciĂłn a Dropbox
Telecollaborative games for youngsters: impact on motivation
Teaching languages for specific purposes in a dynamic digital era: The power...
IntroduciĂłn a Gmail para profesorado da Xunta de Galicia

Similar to Serenity/JS - next generation acceptance testing for modern web applications (20)

PDF
Screenplay - Next generation automated acceptance testing
PDF
Shift left-devoxx-pl
PPTX
Testing as a Career
PPTX
Shifting Security Left from the Lean+Agile 2019 Conference
PPTX
Zero touch QA automation platform for DevOps
PDF
How DevSecOps is Changing the Landscape of Software Testing in 2025.pdf
PDF
DevOps2018 Singapore Eliminating the dev versus ops mentality
PPTX
Shifting security all day dev ops
PPTX
QM in Software Projects
PDF
[Europe merge world tour] Coverity Development Testing
PPTX
Agile-plus-DevOps Testing for Packaged Applications
PPTX
Adopting Agile
PPTX
Fundamentals of software testing
DOCX
DOCX
PPTX
Does dev ops need continuous testing devops days des moines 2018 v1
PPTX
DevSecOps without DevOps is Just Security
PPT
Acceptance Testing Driven Development, TDD
PPTX
Devops is a Verb
PPTX
Where Testers & QA Fit in the Story of DevOps
Screenplay - Next generation automated acceptance testing
Shift left-devoxx-pl
Testing as a Career
Shifting Security Left from the Lean+Agile 2019 Conference
Zero touch QA automation platform for DevOps
How DevSecOps is Changing the Landscape of Software Testing in 2025.pdf
DevOps2018 Singapore Eliminating the dev versus ops mentality
Shifting security all day dev ops
QM in Software Projects
[Europe merge world tour] Coverity Development Testing
Agile-plus-DevOps Testing for Packaged Applications
Adopting Agile
Fundamentals of software testing
Does dev ops need continuous testing devops days des moines 2018 v1
DevSecOps without DevOps is Just Security
Acceptance Testing Driven Development, TDD
Devops is a Verb
Where Testers & QA Fit in the Story of DevOps
Ad

Recently uploaded (20)

PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Essential Infomation Tech presentation.pptx
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
System and Network Administration Chapter 2
PDF
top salesforce developer skills in 2025.pdf
PDF
Understanding Forklifts - TECH EHS Solution
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
ai tools demonstartion for schools and inter college
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Design an Analysis of Algorithms I-SECS-1021-03
Adobe Illustrator 28.6 Crack My Vision of Vector Design
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Essential Infomation Tech presentation.pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
 
Navsoft: AI-Powered Business Solutions & Custom Software Development
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
System and Network Administration Chapter 2
top salesforce developer skills in 2025.pdf
Understanding Forklifts - TECH EHS Solution
Internet Downloader Manager (IDM) Crack 6.42 Build 41
ai tools demonstartion for schools and inter college
How to Migrate SBCGlobal Email to Yahoo Easily
2025 Textile ERP Trends: SAP, Odoo & Oracle
Odoo POS Development Services by CandidRoot Solutions
PTS Company Brochure 2025 (1).pdf.......
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Odoo Companies in India – Driving Business Transformation.pdf
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Design an Analysis of Algorithms I-SECS-1021-03
Ad

Serenity/JS - next generation acceptance testing for modern web applications