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
40
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
22
The Framework That Knows Its Bugs
apetkova
0
250
Automation Frameworks: First Contact
apetkova
0
150
Quality And The Squad Framework
apetkova
0
210
Motivation 3.0: Burying the carrot & stick
apetkova
0
190
Ex Machina: The framework that knows its bugs
apetkova
0
130
Other Decks in Technology
See All in Technology
Google Cloud の AI を支える裏側のインフラを垣間見る!
maroon1st
0
360
複雑な構成要素を持つUIとの向き合い方 〜新・支出グラフでの実例〜 / B43 TECH TALK
nakamuuu
0
140
LayerXにおけるLLMプロダクト開発の今までとこれから
layerx
PRO
1
370
20240418_Google ColabにLLMが搭載されたようなのでPython x データ分析の勉強方法を考えてみる
doradora09
0
140
今年のRubyKaigiはProfiler Year🤘
osyoyu
0
170
Azure犬駆動開発の記録/GlobalAzureFukuoka2024_20240420
nina01
1
220
MapLibreとAmazon Location Service
dayjournal
1
160
Janus
bkuhlmann
1
490
Gitlab本から学んだこと - そーだいなるプレイバック / gitlab-book
soudai
4
440
Python と Snowflake はズッ友だょ!~ Snowflake の Python 関連機能をふりかえる ~
__allllllllez__
1
120
Cracking the KubeCon CfP
inductor
2
250
Tellus の衛星データを見てみよう #mf_fukuoka
kongmingstrap
0
210
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
43
6.8k
Unsuck your backbone
ammeep
663
57k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
20
1.9k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
501
140k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
7
1k
Writing Fast Ruby
sferik
621
60k
Music & Morning Musume
bryan
41
5.6k
VelocityConf: Rendering Performance Case Studies
addyosmani
320
23k
Code Review Best Practice
trishagee
55
15k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
19
1.7k
Building a Scalable Design System with Sketch
lauravandoore
456
32k
Designing with Data
zakiwarfel
96
4.8k
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