Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Objectify the Screenplay: A Story of Patterns
Search
apetkova
March 18, 2017
Technology
0
48
Objectify the Screenplay: A Story of Patterns
QA: Challenge Accepted 3.0 presentation
apetkova
March 18, 2017
Tweet
Share
More Decks by apetkova
See All by apetkova
Stop Testing, Start Building Quality
apetkova
0
28
The Framework That Knows Its Bugs
apetkova
0
270
Automation Frameworks: First Contact
apetkova
0
150
Quality And The Squad Framework
apetkova
0
220
Motivation 3.0: Burying the carrot & stick
apetkova
0
200
Ex Machina: The framework that knows its bugs
apetkova
0
140
Other Decks in Technology
See All in Technology
Evolving DevOps Teams and Flexible Organizational Culture
kakehashi
1
220
四国のあのイベントの〇〇システムを45日間で構築した話 / cloudohenro2024_tachibana
biatunky
0
290
忙しい人のためのLangGraph概要まとめ
__ymgc__
1
120
疎通2024
sadnessojisan
5
980
「家族アルバム みてね」における運用管理・ オブザーバビリティの全貌 / Overview of Operation Management and Observability in FamilyAlbum
isaoshimizu
4
120
contenteditableと向き合う
kikuchikakeru
2
250
四国クラウドお遍路 2024 in 高知 エンディング
yukataoka
0
170
RAGHack: Building RAG apps in Python
pamelafox
0
150
脆弱星に導かれて
nishimunea
1
1.6k
Javaにおける関数型プログラミンへの取り組み
skrb
7
290
ロリポップ! for Gamersを支えるインフラ/lolipop for gamers infrastructure
takumakume
0
110
夏休みの(最後の)宿題 for JuliaTokyo #12
antimon2
0
140
Featured
See All Featured
Keith and Marios Guide to Fast Websites
keithpitt
408
22k
Into the Great Unknown - MozCon
thekraken
28
1.4k
Optimizing for Happiness
mojombo
375
69k
Designing with Data
zakiwarfel
98
5k
Java REST API Framework Comparison - PWX 2021
mraible
PRO
27
7.4k
A Modern Web Designer's Workflow
chriscoyier
691
190k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
24
590
XXLCSS - How to scale CSS and keep your sanity
sugarenia
246
1.3M
How to name files
jennybc
75
98k
The Power of CSS Pseudo Elements
geoffreycrofte
71
5.2k
Optimising Largest Contentful Paint
csswizardry
29
2.8k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
27
8.9k
Transcript
A STORY OF PATTERNS
About Me Aneta Petkova Automation QA Lead, Honeywell Aerospace
[email protected]
linkedin.com/in/apetkova/
Overview Journey #1: Back in time ••The PageObject pattern Journey
#2: Into the now ••The Screenplay pattern Journey #3: Looking at tomorrow ••No spoilers yet
Why should we care about patterns?
The PageObject
PageObject: concept Web Page Page class Test Separation: Keeping things
tidy
PageObject: structure WebDriver config
PageObject: structure WebDriver config Page Object classes
PageObject: structure WebDriver config Page Object classes Test classes
PageObject Web Java private WebElement folderNameLabel; private WebElement downloadAllLink; private
List<WebElement> files; public void sortByName(); public void downloadAll();
PageObject The test method @Test public void sortTest() { BrowseFolderPage
page = new BrowseFolderPage(); page.sortFilesByName(); List<String> actualFileNames = page.getFileNames(); List<String> expectedFileNames = new ArrayList<String>(actualFileNames); expectedFileNames.sort(); Assert.assertEquals(actualFileNames, expectedFileNames, "File names do not match"); }
PageObject The test method @Test public void sortTest() { BrowseFolderPage
page = new BrowseFolderPage(); page.sortFilesByName(); List<String> actualFileNames = page.getFileNames(); List<String> expectedFileNames = new ArrayList<String>(actualFileNames); expectedFileNames.sort(); Assert.assertEquals(actualFileNames, expectedFileNames, "File names do not match"); }
PageObject The test method @Test public void sortTest() { BrowseFolderPage
page = new BrowseFolderPage(); page.sortFilesByName(); List<String> actualFileNames = page.getFileNames(); List<String> expectedFileNames = new ArrayList<String>(actualFileNames); expectedFileNames.sort(); Assert.assertEquals(actualFileNames, expectedFileNames, "File names do not match"); }
PageObject The test method @Test public void sortTest() { BrowseFolderPage
page = new BrowseFolderPage(); page.sortFilesByName(); List<String> actualFileNames = page.getFileNames(); List<String> expectedFileNames = new ArrayList<String>(actualFileNames); expectedFileNames.sort(); Assert.assertEquals(actualFileNames, expectedFileNames, "File names do not match"); } baby_corgi.jpg cartoon_corgi.png snow_corgi.jpg
PageObject The test method @Test public void sortTest() { BrowseFolderPage
page = new BrowseFolderPage(); page.sortFilesByName(); List<String> actualFileNames = page.getFileNames(); List<String> expectedFileNames = new ArrayList<String>(actualFileNames); expectedFileNames.sort(); Assert.assertEquals(actualFileNames, expectedFileNames, "File names do not match"); }
Payoff
Payoff
Payoff
Pitfalls
Pitfalls
Pitfalls
The PageObject
The Screenplay pattern System functionality before system properties Actions before
objects
Screenplay: concept Actor
Screenplay: concept Actor Abilities has
Screenplay: concept Actor Abilities has Actions Tasks enable made up
of performs
Screenplay: concept Actor Abilities Actions Tasks has enable made up
of performs Questions Elements Screen asks about the state of on the interact with
Screenplay: library “Automated Acceptance Testing with Style” - and great
reporting! /Thucydides.info
Screenplay: structure Page Objects
Screenplay: structure Tasks Page Objects
Screenplay: structure State checks Tasks Page Objects
Screenplay: structure Features -> tests State checks Tasks Page Objects
Screenplay The PageObject class public static Target FOLDER_NAME = the(“Folder
name label”).locatedBy(“#locator”); public static Target DOWNLOAD_ALL = the(“Download All link”).locatedBy(“#locator”); public static Target FILES = the(“List of files”).locatedBy(“#locator”);
Screenplay The test method @Test public void should_be_able_to_sort_his_files_by_name() { roland.wasAbleTo(StartWith.aPopulatedFolder());
roland.attemptsTo(SortFilesInFolder.by("Name")); roland.should(seeThat(FileList.displayed(), is(FileList.orderedBy(system)))); }
Screenplay The test method @Test public void should_be_able_to_sort_his_files_by_name() { roland.wasAbleTo(StartWith.aPopulatedFolder())
roland.attemptsTo(SortFilesInFolder.by("Name")); roland.should(seeThat(FileList.displayed(), is(FileList.orderedBy(system)))); }
Screenplay The test method @Test public void should_be_able_to_sort_his_files_by_name() { roland.wasAbleTo(StartWith.aPopulatedFolder());
roland.attemptsTo(SortFilesInFolder .by("Name")); roland.should(seeThat(FileList.displayed(), is(FileList.orderedBy(system)))); }
Screenplay The test method @Test public void should_be_able_to_sort_his_files_by_name() { roland.wasAbleTo(StartWith.aPopulatedFolder());
roland.attemptsTo(SortFilesInFolder.by("Name")); roland.should(seeThat(FileList.displayed(), is(FileList.orderedBy(system)))); }
Serenity report
Serenity report
Payoff
Payoff
Payoff
Payoff
Pitfalls
Pitfalls
Pitfalls
Pitfalls
The middle ground
The middle ground ØFocus on users, not asserts
The middle ground ØFocus on users, not asserts ØKeep tasks
in separate classes
The middle ground ØFocus on users, not asserts ØKeep tasks
in separate classes ØConsider relaxed encapsulation
Define your own journey!
[email protected]
linkedin.com/in/apetkova