SlideShare a Scribd company logo
1 of 73
Download to read offline
Hands on exploration of Page 
Objects and Abstraction Layers with 
Selenium WebDriver 
A Half Day Tutorial 
Alan Richardson 
@eviltester 
alan@compendiumdev.co.uk 
www.SeleniumSimplified.com 
www.EvilTester.com 
www.CompendiumDev.co.uk 
www.JavaForTesters.com
2 
Blogs and Websites 
● CompendiumDev.co.uk 
● SeleniumSimplified.com 
● EvilTester.com 
● JavaForTesters.com 
● Twitter: @eviltester 
Online Training Courses 
● Technical Web Testing 101 
Unow.be/at/techwebtest101 
● Intro to Selenium 
Unow.be/at/startwebdriver 
● Selenium 2 WebDriver API 
Unow.be/at/webdriverapi 
Videos 
youtube.com/user/EviltesterVideos 
Books 
Selenium Simplified 
Unow.be/rc/selsimp 
Java For Testers 
leanpub.com/javaForTesters 
Alan Richardson 
uk.linkedin.com/in/eviltester 
Independent Test Consultant 
& Custom Training 
Contact Alan 
http://compendiumdev.co.uk/contact
After gaining some experience of web automation tools, you start to realise that “yes, you have to 
learn the API”, but the real challenge is modeling the application and building an abstraction layer 
which supports different approaches to automation. And when we build an abstraction layer, we have 
lots of options to choose between. 
3 
● Do you use the Page Factory? 
● What counts as a page object? 
● Should a page object offer logical functions like “loginAs” or does it only model the physical 
world? 
● How do we deal with navigation? Return page objects, or with a different set of objects? 
● Do we need abstractions for Dom elements like input fields or is WebElement enough? 
● When do we synchronise with WebDriverWait and when do we use SlowLoadableComponent? 
● Should we build our own abstractions on top of SlowLoadableComponent? 
By using a simple web application, we will use these, and other questions, to discuss and experiment 
with, the most challenging parts of Web Automation – the modeling and construction of robust and 
re-usable abstraction layers. 
Existing practitioners, be prepared to discuss the choices you have made in the past, what worked, 
and what didn’t, so that we can learn and possibly build on some of those decisions. 
This is open to novices and experienced practitioners, but if you want to take part then make sure 
you have a functioning Selenium WebDriver installation. All examples will be presented using Java, 
but that doesn’t stop you writing experiments in Python, .Net, or whatever other language you favour. 
Bring your laptop, and you’ll have the opportunity to explore different ways of building Page Objects 
and abstraction layers.
4 
Logistics & Plan 
● 11:00 – 12:30 == 1.5 
– Intro 
– General Abstractions Overview 
– Example Implementations & Discussions 
– Exercise (till lunch) 
● Given some scenarios, create some tests and abstraction 
layers to support your tests 
● 13:30 – 15:00 == 1.5 
– Continue exercises and debrief 
– Examples and Comparison with group 
– Exercise (till end) 
● Adjust your code, refactor to other approaches
5 
Code Examples & Slides 
● http://unow.be/at/letstest2014sweden 
● https://xp-dev.com/svn/AutomationAbstractions 
● http://unow.be/at/letstest2014sweden
6 
Experiences Check 
● Used WebDriver? 
● What Languages? 
● Abstraction Layers? 
● Frameworks? 
● Current setup 
– Laptop With You? 
– Ready to code?
7 
General Abstraction Concepts
“I must create a system. or be 
enslav'd by another Mans; I 
will not reason & compare: 
my business is to create” 
8 
William Blake, 
Jerusalem: The Emanation of the Giant Albion 
http://www.blakearchive.org/exist/blake/archive/object.xq?objectid=jerusalem.e.illbk.10&java=no
9 
What is Abstraction? 
● Discuss
10 
Abstraction 
● Modelling 
● Separation of concerns 
● Logical vs Physical 
● Functional vs Structural 
● Interfaces vs Implementations 
● Data / Entities / Persistence 
● Functionality / Task Flow 
● Goals / Strategies 
● Layers – GUI, DB, HTTP 
● Etc.
11 
Example Test Without Abstraction 
@Before 
public void startDriver(){ 
@Test 
public void canCreateAToDoWithNoAbstraction(){ 
driver.get("http://todomvc.com/architecture-examples/backbone/"); 
int originalNumberOfTodos = driver.findElements( 
By.cssSelector("ul#todo-list li")).size(); 
WebElement createTodo = driver.findElement(By.id("new-todo")); 
createTodo.click(); 
createTodo.sendKeys("new task"); 
createTodo.sendKeys(Keys.ENTER); 
assertThat(driver.findElement( 
By.id("filters")).isDisplayed(), is(true)); 
int newToDos = driver.findElements( 
By.cssSelector("ul#todo-list li")).size(); 
assertThat(newToDos, greaterThan(originalNumberOfTodos)); 
} 
driver = new FirefoxDriver(); 
} 
@After 
public void stopDriver(){ 
driver.close(); 
driver.quit(); 
} 
NoAbstractionTest.java
12 
Example Test With Abstraction 
@Before 
public void startDriver(){ 
@Test 
public void canCreateAToDoWithAbstraction(){ 
TodoMVCUser user = new TodoMVCUser(driver, new TodoMVCSite()); 
user.opensApplication().and().createNewToDo("new task"); 
ApplicationPageFunctional page = 
new ApplicationPageFunctional(driver, new TodoMVCSite()); 
assertThat(page.getCountOfTodoDoItems(), is(1)); 
assertThat(page.isFooterVisible(), is(true)); 
} 
driver = new FirefoxDriver(); 
} 
@After 
public void stopDriver(){ 
driver.close(); 
driver.quit(); 
} NoAbstractionTest.java
13 
Why Abstraction? 
● Change implementations 
● Single Responsibility – only changes when 
necessary 
● Makes automation readable and maintainable
“...The name of the song is called ‘Haddocks' Eyes.’” 
“Oh, that's the name of the song, is it?" Alice said, trying to feel 
interested. 
“No, you don't understand,” the Knight said, looking a little vexed. 
“That's what the name is called. The name really is ‘The Aged 
Aged Man.’” 
“Then I ought to have said ‘That's what the song is called’?” Alice 
corrected herself. 
“No, you oughtn't: that's quite another thing! The song is called 
‘Ways And Means’: but that's only what it's called, you know!” 
“Well, what is the song, then?” said Alice, who was by this time 
completely bewildered. 
“I was coming to that,” the Knight said. “The song really is ‘A-sitting 
On A Gate’: and the tune's my own invention.”” 
14 
Lewis Carroll, Through The Looking Glass
15 
Common Abstraction Approaches
16 
Abstraction Layers Categorised 
1) Data 
– Generic Data Abstractions e.g. email, postcode 
2) Physical 
– Physical layout of your application e.g. pages, 
components 
– Navigation across pages 
3) Domain 
– Your application Entities domain e.g. user, account 
4) Logical 
– User actions, workflows
17 
Common Automation Abstractions 
● Page Objects 
● Element Abstractions: select, textbox, etc. 
● Domain Objects 
● Gherkin (Given/When/And/Then) 
● Domain Specific Languages 
● Any More? 
– Create a List to discuss 
– Any public examples? 
– Any examples in the room that can be shared?
18 
Abstractions
19 
Abstraction != Implementation 
● Abstraction != Tool / Framework / 
Implementation 
● Gherkin != Cucumber 
● Page Object != Page Factory 
● DSL != Keyword Driven 
If we want to get good at abstraction then we 
need to model, split apart, and make the 
relationships clear
20 
WebDriver as an Abstraction Layer 
● Dom Abstraction 
– WebElement 
● Browser Abstraction 
– WebDriver 
● FireFox, Chrome, Remote etc. 
● HTML Abstractions 
– Cookies, Frames, etc. 
● 'Support' classes augment WebDriver 
– e.g. com.seleniumsimplified.selenium.support
21 
Model the application under test
22 
Given an App – todomvc.com
23 
TodoMVC.com 
Functional Overview 
Demo 
● Single Page App 
● Shows Counts 
● Data held in HTML5 local storage 
● Create/Edit/Complete a 'todo' 
● Clear Completed 
● Filter active/completed/all 
● Delete a todo
24 
Exercise Given an App – 
todomvc.com 
● What Abstractions might we build? 
● What thoughts do we have? 
● What underpins our analysis? 
...Then Debrief
Example Implementations Overview 
25
26 
Page Objects 
● The most obvious 
automation abstraction 
● What is it? 
– A page? A Component? 
● Experiences? 
● Do web applications still 
have pages?
27 
Page Object Design Decisions 
● What methods does it have? 
– Functional 
● login(username, password), 
● loginAs(user) 
– Structural 
● enterName(username), enterPassword(password), 
clickLogin(), submitLoginForm(username, password) 
● Does it expose elements or not? 
– public WebElement loginButton; 
– public WebElement getLoginButton(); 
– public clickLoginButton();
28 
Navigation Design Decisions 
● Does a Page Object return other pages? 
public IssueListPage submit(){ 
driver.findElement(By.id(“submit”)).click(); 
return new IssueListPage(driver); 
} 
● Pros? 
● Cons? 
● Experiences
29 
Page Objects 
● What rules / guidelines / biases do you use for 
page objects?
30 
Implementing Page Objects 
● POJO 
– Plain object, driver in constructor, methods use 
driver.<method> 
● Page Factory 
– Annotated elements, lazy instantiation via reflection 
● LoadableComponent 
– Common interface (load, isLoaded), isLoaded 
throws Error 
● SlowLoadableComponent 
– Common interface, waits for on isLoaded 
● Other approaches?
31 
Implicit or Explicit Wait? 
● Implicit Wait 
driver.manage().timeouts(). 
implicitlyWait(15L, TimeUnit.SECONDS); 
assertThat(driver.findElement( 
By.id("filters")).isDisplayed() 
, is(true)); 
● Explicit Wait 
driver.manage().timeouts(). 
implicitlyWait(0L, TimeUnit.SECONDS); 
WebDriverWait wait = new WebDriverWait(driver,15); 
wait.until(ExpectedConditions.elementToBeClickable 
(By.id("filters"))); 
Example: 'NoAbstractionTest.java'
32 
Exercise Automate Scenarios 
● Create a ToDo (check: count, text) 
● Can Delete a ToDo (check: footers, count) 
● Can Mark a ToDo as completed 
● Can create a bunch of ToDos and delete, mark 
as complete etc. 
● Add additional checks as required 
● Create Abstraction layers as appropriate 
● We will discuss your compare your examples 
with the group and the examples
33 
Example Implementations
34 
POJO 
● 'ApplicationPage.java' 
– Used in 'SequentialCreationOfTest.java' 
– Not much refactoring in the example 
● Simple Class 
● WebDriver passed to constructor 
● Composition of any components
35 
POJO Discussion 
● Pros 
● Cons
36 
Functional vs Structural 
● Compare 'ApplicationPage' with 'ApplicationPageFunctional' 
● Functional 
– loginAs(username, password) 
● Structural 
– enterUsername 
– enterPassword 
– clickLoginButton 
– submitLoginForm(username, password) 
● Navigation 
– Should Page Objects return Page Objects?
37 
Functional Vs Structural Example 
● One way of answering “what methods to put on 
a page object” 
– Is it functional / behavioural? 
– Is it structural? 
● Functional 'uses' Structural implementation 
● See 
– com.seleniumsimplified.page.functionalvsstructural
38 
Page Factory 
● Compare ApplicationPageStructural with 
ApplicationPageStructuralFactory 
● Annotate fields with @FindBy 
● Instantiate in constructor using 
PageFactory.initElements 
– Can create your own page factory initialiser
39 
Page Factory Example 
@FindBy(how = How.CSS, using="#todo-count strong") 
private WebElement countElementStrong; 
@FindBy(how = How.CSS, using="#todo-count") 
private WebElement countElement; 
@FindBy(how = How.CSS, using="#filters li a") 
List<WebElement> filters; 
@FindBy(how = How.ID, using="clear-completed") 
List<WebElement> clearCompletedAsList; 
@FindBy(how = How.ID, using="clear-completed") 
WebElement clearCompletedButton; 
public ApplicationPageStructuralFactory(WebDriver driver, TodoMVCSite todoMVCSite) { 
PageFactory.initElements(driver, this); 
this.driver = driver; 
...
40 
Page Factory Discussion 
● Pros 
● Cons
41 
Loadable Component 
● Extends LoadableComponent 
– Get 
● If isLoaded, return this 
● Else load() 
● Check isLoaded() 
● Implement load 
– Add any synchronisation in load to wait for the 
loading. Exit only when 'loaded'. 
● Implement isLoaded 
– Check, and throw Error if not loaded
42 
Loadable Component Example 
● Compare ApplicationPageStructural with 
ApplicationPageStructuralLoadable
43 
Loadable Component Discussion 
● Pros 
● Cons
SlowLoadable Component Example 
44 
● Extends SlowLoadableComponent 
● Constructor has to additionally call 
– super(new SystemClock(), 10); 
– Where 10 is a timeout # of seconds 
● get() 
– If isLoaded then return this Else load 
– While not loaded{ wait for 200 millseconds} 
● Implement load and isLoaded 
– But can remove sync loops from load
SlowLoadable Component Example 
45 
● Compare ApplicationPageStructural with 
ApplicationPageStructuralSlowLoadable
46 
SlowLoadable Component 
Discussion 
● Pros 
● Cons
47 
Fluent Page Objects 
● Methods return the page object or other objects 
– e.g. get() on LoadableComponent 
● Instead of 
– void clickDeleteButton(); 
– PageObject clickDeleteButton(); 
● Syntactic sugar methods: 
– and(), then(), also() 
● Work well at high levels of abstraction 
– See SequentialCreationOfTestFluentSubset and 
ApplicationPageFunctionalFluent 
– Compare ApplicationPageFunctional with ...Fluent
● Direct in Test Navigation Options 
● Instantiate new pages based on test flow 
48 
– Navigation as side-effect, may have to bypass 'get' 
– Loadable pages, non-loadable, support classes 
● Page Object methods might return other Pages 
– e.g. a method on the login page might be 
● MyAccountPage clickLogin(); 
– Returns a new page 
● void clickLogin(); 
● We might use navigation objects 
– direct, or Path based (current page → desired 
page) 
● Navigate.to(MyAccountPage.class) 
● Jump.to(MyAccountPage.class)
49 
Possible Domain Abstractions 
● Logical Objects 
– ToDo 
– ToDoList 
● Physical Objects 
– LocallyStoredToDo 
● Actors 
– User 
● Environment 
– Site 
– Implementation
50 
Page Objects & Domain Objects 
● Instead of 
– todoMVC.enterNewToDo(“New Item”) 
● We could have have 
– ToDoItem newItem = new ToDoItem(“New Item”); 
– todoMVC.enterNewToDo(newItem); 
● Discuss 
● See code in DomainBasedTest
51 
Domain Objects That Span Logical 
& Physical 
e.g. User 
● user.createNewToDo(“new item”) 
● user.createNewToDo(newItem) 
● Discuss 
● See use in NoAbstractionTest
52 
Element Abstractions
53 
Element Abstractions 
● Existing support: Select, 
● Possible: TextBox, Checkbox, TextBox, File etc. 
● Can enforce Semantics 
– Checkbox: isChecked, check(), uncheck(), toggle() 
– TextBox: clear(), enterText() 
– etc. 
● Pass back from Page Objects into test? 
● e.g. Checkbox in ElementWrapperTest 
– new CheckBox(driver, By); 
– new CheckBox(element)
54 
Element Abstraction Examples 
public interface Checkbox { 
public boolean isChecked(); 
public Checkbox check(); 
public Checkbox uncheck(); 
public Checkbox toggle(); 
} 
● Would you include 'toggle'?
Element Abstraction Pros and Cons 
55 
● May have to create a custom page factory 
● Can help 'restrict' code i.e. check or uncheck, 
rather than click, enforces 'semantics' 
● I make sure to return WebElement so that I can 
go beyond the abstraction layer if I need to. Not 
required if it is just a WebElement wrapper.
56 
Component Abstractions 
● Components on the screen 
– e.g. ComponentTest 
● e.g. VisibleToDoEntry, Filters, Footer, Header, 
VisibleToDoList, etc. 
● Could have 'functional' representation for 
repeated items e.g. login forms 
● Could have 'structural' representation 
● Likely use : page object composition
57 
Component Abstraction Example 
page.getToDoEntryAt(todoMVC.getCountOfTodoDoItems()-1). 
markCompleted(); 
● See 'ComponentTest.java' 
– ApplicationPageStructuralComponents (compare 
with ApplicationPageStructural 
– VisibleToDoEntry 
● (this also uses Element Abstraction)
58 
Gherkin as an abstraction layer 
Feature: We can create and edit To Do lists in ToDoMvc 
We want to amend todos in ToDoMVC because that is 
the set of exercises on the abstraction tutorial 
Scenario: Create a ToDo Item 
Given a user opens a blank ToDoMVC page 
When the user creates a todo "new task" 
Then they see 1 todo item on the page 
● Implement steps using highest appropriate 
abstraction layer 
● CucumberJVM as 'DSL implementor' 
● 'Expressibility' vs 'Step Re-use' 
● See todomvc.feature and ToDoMvcSteps
59 
Additional Debrief 
● Did anyone do anything different? 
● Any other abstraction approaches you used? 
● Anything else to add?
60 
Final Exercise Section 
● Continue to automate the site 
● Build abstraction layers to cover the 
functionality 
● Experiment with additional approaches 
mentioned that you haven't used 
● Or, use code and amend and experiment
61 
Final Debrief
62 
My bias model has Driver as core 
● Driver 
– Build around that so instantiate any page or 
component as required at any time 
● Synchronisation 
– To make sure that the desired object is available 
and ready for use (as defined by synchronisation) 
● Navigation 
– Implicit (via actions) 
– Explicit 
● Open/jump (via driver.get) 
● To (state model from current, to desired)
63 
Biases 
● Examine some common biases and discuss 
pros/cons based on experience
64 
Are there rights and wrongs? 
● Right / Wrong? 
● Decisions? 
● Project/Team/Organisation Standards?
65 
Should we add asserts into 
abstraction layers? 
● e.g.
Should Page Objects consume and 
66 
return domain objects? 
● e.g. 
– loginAs(user) 
– List<User> getUsersList()
67 
Should Page Objects return 
WebElements?
68 
Decisions 
● The 'limits' and overlap of Abstraction Layers 
● Build it now, or 'refactor to' later 
● How much change is anticipated? 
– To which layer? GUI, Business domain, Workflow? 
● Who is working with the automation code? 
– Skill levels? Support needed? 
● How/When with the automation execute?
69 
Decisions 
● The 'limits' and overlap of Abstraction Layers 
● Build it now, or 'refactor to' later 
● How much change is anticipated? 
– To which layer? GUI, Business domain, Workflow? 
● Who is working with the automation code? 
– Skill levels? Support needed? 
● How/When with the automation execute?
70 
“To the creative mind there is 
no right or wrong. Every 
action is an experiment, and 
every experiment yields its 
fruit in knowledge.” 
The Illuminatus Trilogy 
Robert Anton Wilson
71 
Other Useful Links 
● Jeff “Cheezy” Morgan – page-object ruby gem, 
data_magic gem and stareast code 
– https://github.com/cheezy?tab=repositories 
● Marcus Merrell 
– Self-Generating Test Artifacts for Selenium/WebDriver 
– https://www.youtube.com/watch?v=mSCFsUOgPpw
72 
Blogs and Websites 
● CompendiumDev.co.uk 
● SeleniumSimplified.com 
● EvilTester.com 
● JavaForTesters.com 
● Twitter: @eviltester 
Online Training Courses 
● Technical Web Testing 101 
Unow.be/at/techwebtest101 
● Intro to Selenium 
Unow.be/at/startwebdriver 
● Selenium 2 WebDriver API 
Unow.be/at/webdriverapi 
Videos 
youtube.com/user/EviltesterVideos 
Books 
Selenium Simplified 
Unow.be/rc/selsimp 
Java For Testers 
leanpub.com/javaForTesters 
Alan Richardson 
uk.linkedin.com/in/eviltester 
Independent Test Consultant 
& Custom Training 
Contact Alan 
http://compendiumdev.co.uk/contact
73 
Notes: Install app locally 
● https://github.com/tastejs/todomvc/commit/f57e0b773db14f094ef09274af90042f83328412 
● https://github.com/tastejs/todomvc/archive/f57e0b773db14f094ef09274af90042f83328412.zip 
● Point Site url to file:// location unarchive and run tests – absolute links won't work without a 
server

More Related Content

What's hot

Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web ApplicationsSeth McLaughlin
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsSeth McLaughlin
 
Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternSargis Sargsyan
 
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)Faichi Solutions
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David TorroijaDavid Torroija
 
Selenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver TutorialSelenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver TutorialAlan Richardson
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsLuís Bastião Silva
 
Real World Selenium Testing
Real World Selenium TestingReal World Selenium Testing
Real World Selenium TestingMary Jo Sminkey
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksAddy Osmani
 
High Performance JavaScript 2011
High Performance JavaScript 2011High Performance JavaScript 2011
High Performance JavaScript 2011Nicholas Zakas
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Hazem Saleh
 
Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Oren Rubin
 
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Iakiv Kramarenko
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at TiltDave King
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Codemotion
 
APIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsAPIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsSauce Labs
 
20160905 - BrisJS - nightwatch testing
20160905 - BrisJS - nightwatch testing20160905 - BrisJS - nightwatch testing
20160905 - BrisJS - nightwatch testingVladimir Roudakov
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorCubet Techno Labs
 
Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Joe Ferguson
 

What's hot (20)

Testing Web Applications
Testing Web ApplicationsTesting Web Applications
Testing Web Applications
 
Join the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.jsJoin the darkside: Selenium testing with Nightwatch.js
Join the darkside: Selenium testing with Nightwatch.js
 
Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component Pattern
 
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)Automate testing with behat, selenium, phantom js and nightwatch.js (5)
Automate testing with behat, selenium, phantom js and nightwatch.js (5)
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David Torroija
 
Selenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver TutorialSelenium Clinic Eurostar 2012 WebDriver Tutorial
Selenium Clinic Eurostar 2012 WebDriver Tutorial
 
Browser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.jsBrowser Automated Testing Frameworks - Nightwatch.js
Browser Automated Testing Frameworks - Nightwatch.js
 
Real World Selenium Testing
Real World Selenium TestingReal World Selenium Testing
Real World Selenium Testing
 
jQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & TricksjQuery Proven Performance Tips & Tricks
jQuery Proven Performance Tips & Tricks
 
High Performance JavaScript 2011
High Performance JavaScript 2011High Performance JavaScript 2011
High Performance JavaScript 2011
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
 
Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014
 
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
Selenide Alternative in Practice - Implementation & Lessons learned [Selenium...
 
Nightwatch at Tilt
Nightwatch at TiltNightwatch at Tilt
Nightwatch at Tilt
 
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
Carmen Popoviciu - Protractor styleguide | Codemotion Milan 2015
 
Night Watch with QA
Night Watch with QANight Watch with QA
Night Watch with QA
 
APIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page ObjectsAPIs: A Better Alternative to Page Objects
APIs: A Better Alternative to Page Objects
 
20160905 - BrisJS - nightwatch testing
20160905 - BrisJS - nightwatch testing20160905 - BrisJS - nightwatch testing
20160905 - BrisJS - nightwatch testing
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using Protractor
 
Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015 Acceptance & Functional Testing with Codeception - Devspace 2015
Acceptance & Functional Testing with Codeception - Devspace 2015
 

Viewers also liked

Using The Page Object Pattern
Using The Page Object PatternUsing The Page Object Pattern
Using The Page Object PatternDante Briones
 
Lessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorialLessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorialAlan Richardson
 
Why You Should Learn Skills That Have No Application in Real Life
Why You Should Learn Skills That Have No Application in Real LifeWhy You Should Learn Skills That Have No Application in Real Life
Why You Should Learn Skills That Have No Application in Real LifeAlan Richardson
 
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingBDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingJohn Ferguson Smart Limited
 
Abstraction Layers Test Management Summit Faciliated Session 2014
Abstraction Layers Test Management Summit Faciliated Session 2014Abstraction Layers Test Management Summit Faciliated Session 2014
Abstraction Layers Test Management Summit Faciliated Session 2014Alan Richardson
 
Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...
Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...
Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...Alan Richardson
 
Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternSQALab
 
Evil testers guide to technical testing
Evil testers guide to technical testingEvil testers guide to technical testing
Evil testers guide to technical testingAlan Richardson
 
TestWorksConf 2015 Keynote Test Automation Conference Amsterdam
TestWorksConf 2015 Keynote Test Automation Conference AmsterdamTestWorksConf 2015 Keynote Test Automation Conference Amsterdam
TestWorksConf 2015 Keynote Test Automation Conference AmsterdamAlan Richardson
 
Load Test Drupal Site Using JMeter and Amazon AWS
Load Test Drupal Site Using JMeter and Amazon AWSLoad Test Drupal Site Using JMeter and Amazon AWS
Load Test Drupal Site Using JMeter and Amazon AWSVladimir Ilic
 
Lessons Learned When Automating
Lessons Learned When AutomatingLessons Learned When Automating
Lessons Learned When AutomatingAlan Richardson
 
Joint slides Isabel Evans Alan Richardson Feb UKStar 2017
Joint slides Isabel Evans Alan Richardson Feb UKStar 2017Joint slides Isabel Evans Alan Richardson Feb UKStar 2017
Joint slides Isabel Evans Alan Richardson Feb UKStar 2017Alan Richardson
 
Perils of Page-Object Pattern
Perils of Page-Object PatternPerils of Page-Object Pattern
Perils of Page-Object PatternAnand Bagmar
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answersITeLearn
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1Sun Technlogies
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideMek Srunyu Stittri
 

Viewers also liked (20)

Using The Page Object Pattern
Using The Page Object PatternUsing The Page Object Pattern
Using The Page Object Pattern
 
Lessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorialLessons learned with Bdd: a tutorial
Lessons learned with Bdd: a tutorial
 
Why You Should Learn Skills That Have No Application in Real Life
Why You Should Learn Skills That Have No Application in Real LifeWhy You Should Learn Skills That Have No Application in Real Life
Why You Should Learn Skills That Have No Application in Real Life
 
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web TestingBDD, ATDD, Page Objects: The Road to Sustainable Web Testing
BDD, ATDD, Page Objects: The Road to Sustainable Web Testing
 
Abstraction Layers Test Management Summit Faciliated Session 2014
Abstraction Layers Test Management Summit Faciliated Session 2014Abstraction Layers Test Management Summit Faciliated Session 2014
Abstraction Layers Test Management Summit Faciliated Session 2014
 
Beyond Page Objects
Beyond Page ObjectsBeyond Page Objects
Beyond Page Objects
 
Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...
Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...
Test Automation Day 2015 Keynote Alan Richardson - Practical Lessons Learned ...
 
Better Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component PatternBetter Page Object Handling with Loadable Component Pattern
Better Page Object Handling with Loadable Component Pattern
 
Evil testers guide to technical testing
Evil testers guide to technical testingEvil testers guide to technical testing
Evil testers guide to technical testing
 
TestWorksConf 2015 Keynote Test Automation Conference Amsterdam
TestWorksConf 2015 Keynote Test Automation Conference AmsterdamTestWorksConf 2015 Keynote Test Automation Conference Amsterdam
TestWorksConf 2015 Keynote Test Automation Conference Amsterdam
 
Load Test Drupal Site Using JMeter and Amazon AWS
Load Test Drupal Site Using JMeter and Amazon AWSLoad Test Drupal Site Using JMeter and Amazon AWS
Load Test Drupal Site Using JMeter and Amazon AWS
 
Lessons Learned When Automating
Lessons Learned When AutomatingLessons Learned When Automating
Lessons Learned When Automating
 
Joint slides Isabel Evans Alan Richardson Feb UKStar 2017
Joint slides Isabel Evans Alan Richardson Feb UKStar 2017Joint slides Isabel Evans Alan Richardson Feb UKStar 2017
Joint slides Isabel Evans Alan Richardson Feb UKStar 2017
 
Jira
JiraJira
Jira
 
Perils of Page-Object Pattern
Perils of Page-Object PatternPerils of Page-Object Pattern
Perils of Page-Object Pattern
 
Selenium web driver
Selenium web driverSelenium web driver
Selenium web driver
 
Selenium
SeleniumSelenium
Selenium
 
Selenium webdriver interview questions and answers
Selenium webdriver interview questions and answersSelenium webdriver interview questions and answers
Selenium webdriver interview questions and answers
 
Silk Performer Presentation v1
Silk Performer Presentation v1Silk Performer Presentation v1
Silk Performer Presentation v1
 
Node.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java sideNode.js and Selenium Webdriver, a journey from the Java side
Node.js and Selenium Webdriver, a journey from the Java side
 

Similar to Hands on Exploration of Page Objects and Abstraction Layers with Selenium Webdriver Workshop Slides

Selenium withnet
Selenium withnetSelenium withnet
Selenium withnetVlad Maniak
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortalscgack
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernizationdevObjective
 
Introduction to Selenium and Test Automation
Introduction to Selenium and Test AutomationIntroduction to Selenium and Test Automation
Introduction to Selenium and Test AutomationAhmed Mubbashir Khan
 
An introduction to Emulsify
An introduction to EmulsifyAn introduction to Emulsify
An introduction to Emulsifyvaluebound
 
jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013dmethvin
 
Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchExcella
 
Espremendo melancia | TDC2014 Floripa | Chaordic
Espremendo melancia | TDC2014 Floripa | ChaordicEspremendo melancia | TDC2014 Floripa | Chaordic
Espremendo melancia | TDC2014 Floripa | ChaordicCarlos Tadeu Panato Junior
 
Espremendo melancia | TDC2014 Floripa | Chaordic
Espremendo melancia | TDC2014 Floripa | ChaordicEspremendo melancia | TDC2014 Floripa | Chaordic
Espremendo melancia | TDC2014 Floripa | ChaordicChaordic
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptTroy Miles
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahiericjamesblackburn
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumLiraz Shay
 
Discover the power of browser developer tools
Discover the power of browser developer toolsDiscover the power of browser developer tools
Discover the power of browser developer toolsylefebvre
 
Hands On with Selenium and WebDriver
Hands On with Selenium and WebDriverHands On with Selenium and WebDriver
Hands On with Selenium and WebDriverTechWell
 
2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratiehcderaad
 
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)Christian Catalan
 

Similar to Hands on Exploration of Page Objects and Abstraction Layers with Selenium Webdriver Workshop Slides (20)

Selenium withnet
Selenium withnetSelenium withnet
Selenium withnet
 
Selenium Automation
Selenium AutomationSelenium Automation
Selenium Automation
 
Front-End Modernization for Mortals
Front-End Modernization for MortalsFront-End Modernization for Mortals
Front-End Modernization for Mortals
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
Front end-modernization
Front end-modernizationFront end-modernization
Front end-modernization
 
Introduction to Selenium and Test Automation
Introduction to Selenium and Test AutomationIntroduction to Selenium and Test Automation
Introduction to Selenium and Test Automation
 
An introduction to Emulsify
An introduction to EmulsifyAn introduction to Emulsify
An introduction to Emulsify
 
jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013jQuery Conference Austin Sept 2013
jQuery Conference Austin Sept 2013
 
Usable Software Design
Usable Software DesignUsable Software Design
Usable Software Design
 
Automated Acceptance Testing from Scratch
Automated Acceptance Testing from ScratchAutomated Acceptance Testing from Scratch
Automated Acceptance Testing from Scratch
 
Unit testing hippo
Unit testing hippoUnit testing hippo
Unit testing hippo
 
Espremendo melancia | TDC2014 Floripa | Chaordic
Espremendo melancia | TDC2014 Floripa | ChaordicEspremendo melancia | TDC2014 Floripa | Chaordic
Espremendo melancia | TDC2014 Floripa | Chaordic
 
Espremendo melancia | TDC2014 Floripa | Chaordic
Espremendo melancia | TDC2014 Floripa | ChaordicEspremendo melancia | TDC2014 Floripa | Chaordic
Espremendo melancia | TDC2014 Floripa | Chaordic
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScript
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahi
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Discover the power of browser developer tools
Discover the power of browser developer toolsDiscover the power of browser developer tools
Discover the power of browser developer tools
 
Hands On with Selenium and WebDriver
Hands On with Selenium and WebDriverHands On with Selenium and WebDriver
Hands On with Selenium and WebDriver
 
2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie2014 11 20 Drupal 7 -> 8 test migratie
2014 11 20 Drupal 7 -> 8 test migratie
 
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
Testing Vue Apps with Cypress.io (STLJS Meetup April 2018)
 

More from Alan Richardson

Add More Security To Your Testing and Automating - Saucecon 2021
Add More Security To Your Testing and Automating - Saucecon 2021Add More Security To Your Testing and Automating - Saucecon 2021
Add More Security To Your Testing and Automating - Saucecon 2021Alan Richardson
 
Automating to Augment Testing
Automating to Augment TestingAutomating to Augment Testing
Automating to Augment TestingAlan Richardson
 
Open source tools - Test Management Summit - 2009
Open source tools - Test Management Summit - 2009Open source tools - Test Management Summit - 2009
Open source tools - Test Management Summit - 2009Alan Richardson
 
Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020Alan Richardson
 
The Future of Testing Webinar
The Future of Testing WebinarThe Future of Testing Webinar
The Future of Testing WebinarAlan Richardson
 
Secrets and Mysteries of Automated Execution Keynote slides
Secrets and Mysteries of Automated Execution Keynote slidesSecrets and Mysteries of Automated Execution Keynote slides
Secrets and Mysteries of Automated Execution Keynote slidesAlan Richardson
 
Automating Pragmatically - Testival 20190604
Automating Pragmatically - Testival 20190604Automating Pragmatically - Testival 20190604
Automating Pragmatically - Testival 20190604Alan Richardson
 
Joy of Coding Conference 2019 slides - Alan Richardson
Joy of Coding Conference 2019 slides - Alan RichardsonJoy of Coding Conference 2019 slides - Alan Richardson
Joy of Coding Conference 2019 slides - Alan RichardsonAlan Richardson
 
Programming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStringsProgramming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStringsAlan Richardson
 
Technology Based Testing
Technology Based TestingTechnology Based Testing
Technology Based TestingAlan Richardson
 
About Consultant Alan Richardson Compendium Developments Evil Tester
About Consultant Alan Richardson Compendium Developments Evil TesterAbout Consultant Alan Richardson Compendium Developments Evil Tester
About Consultant Alan Richardson Compendium Developments Evil TesterAlan Richardson
 
Automating and Testing a REST API
Automating and Testing a REST APIAutomating and Testing a REST API
Automating and Testing a REST APIAlan Richardson
 
Technical and Testing Challenges: Using the "Protect The Square" Game
Technical and Testing Challenges: Using the "Protect The Square" GameTechnical and Testing Challenges: Using the "Protect The Square" Game
Technical and Testing Challenges: Using the "Protect The Square" GameAlan Richardson
 
TDD - Test Driven Development - Java JUnit FizzBuzz
TDD - Test Driven Development - Java JUnit FizzBuzzTDD - Test Driven Development - Java JUnit FizzBuzz
TDD - Test Driven Development - Java JUnit FizzBuzzAlan Richardson
 
If you want to automate, you learn to code
If you want to automate, you learn to codeIf you want to automate, you learn to code
If you want to automate, you learn to codeAlan Richardson
 
How To Test With Agility
How To Test With AgilityHow To Test With Agility
How To Test With AgilityAlan Richardson
 
Your Automated Execution Does Not Have to be Flaky
Your Automated Execution Does Not Have to be FlakyYour Automated Execution Does Not Have to be Flaky
Your Automated Execution Does Not Have to be FlakyAlan Richardson
 
What is Testability vs Automatability? How to improve your Software Testing.
What is Testability vs Automatability? How to improve your Software Testing.What is Testability vs Automatability? How to improve your Software Testing.
What is Testability vs Automatability? How to improve your Software Testing.Alan Richardson
 

More from Alan Richardson (20)

Add More Security To Your Testing and Automating - Saucecon 2021
Add More Security To Your Testing and Automating - Saucecon 2021Add More Security To Your Testing and Automating - Saucecon 2021
Add More Security To Your Testing and Automating - Saucecon 2021
 
Automating to Augment Testing
Automating to Augment TestingAutomating to Augment Testing
Automating to Augment Testing
 
Open source tools - Test Management Summit - 2009
Open source tools - Test Management Summit - 2009Open source tools - Test Management Summit - 2009
Open source tools - Test Management Summit - 2009
 
Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020Automating Tactically vs Strategically SauceCon 2020
Automating Tactically vs Strategically SauceCon 2020
 
The Future of Testing Webinar
The Future of Testing WebinarThe Future of Testing Webinar
The Future of Testing Webinar
 
Devfest 2019-slides
Devfest 2019-slidesDevfest 2019-slides
Devfest 2019-slides
 
Secrets and Mysteries of Automated Execution Keynote slides
Secrets and Mysteries of Automated Execution Keynote slidesSecrets and Mysteries of Automated Execution Keynote slides
Secrets and Mysteries of Automated Execution Keynote slides
 
Automating Pragmatically - Testival 20190604
Automating Pragmatically - Testival 20190604Automating Pragmatically - Testival 20190604
Automating Pragmatically - Testival 20190604
 
Joy of Coding Conference 2019 slides - Alan Richardson
Joy of Coding Conference 2019 slides - Alan RichardsonJoy of Coding Conference 2019 slides - Alan Richardson
Joy of Coding Conference 2019 slides - Alan Richardson
 
Programming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStringsProgramming katas for Software Testers - CounterStrings
Programming katas for Software Testers - CounterStrings
 
Technology Based Testing
Technology Based TestingTechnology Based Testing
Technology Based Testing
 
About Consultant Alan Richardson Compendium Developments Evil Tester
About Consultant Alan Richardson Compendium Developments Evil TesterAbout Consultant Alan Richardson Compendium Developments Evil Tester
About Consultant Alan Richardson Compendium Developments Evil Tester
 
Shift left-testing
Shift left-testingShift left-testing
Shift left-testing
 
Automating and Testing a REST API
Automating and Testing a REST APIAutomating and Testing a REST API
Automating and Testing a REST API
 
Technical and Testing Challenges: Using the "Protect The Square" Game
Technical and Testing Challenges: Using the "Protect The Square" GameTechnical and Testing Challenges: Using the "Protect The Square" Game
Technical and Testing Challenges: Using the "Protect The Square" Game
 
TDD - Test Driven Development - Java JUnit FizzBuzz
TDD - Test Driven Development - Java JUnit FizzBuzzTDD - Test Driven Development - Java JUnit FizzBuzz
TDD - Test Driven Development - Java JUnit FizzBuzz
 
If you want to automate, you learn to code
If you want to automate, you learn to codeIf you want to automate, you learn to code
If you want to automate, you learn to code
 
How To Test With Agility
How To Test With AgilityHow To Test With Agility
How To Test With Agility
 
Your Automated Execution Does Not Have to be Flaky
Your Automated Execution Does Not Have to be FlakyYour Automated Execution Does Not Have to be Flaky
Your Automated Execution Does Not Have to be Flaky
 
What is Testability vs Automatability? How to improve your Software Testing.
What is Testability vs Automatability? How to improve your Software Testing.What is Testability vs Automatability? How to improve your Software Testing.
What is Testability vs Automatability? How to improve your Software Testing.
 

Recently uploaded

2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Business Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business AnalysisBusiness Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business AnalysisDEEPRAJ PATHAK
 
Santander Stream Processing with Apache Flink
Santander Stream Processing with Apache FlinkSantander Stream Processing with Apache Flink
Santander Stream Processing with Apache Flinkconfluent
 
What is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docxWhat is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docxTechnogeeks
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsJean Silva
 
full course of software engineering mid term.pdf
full course of software engineering mid term.pdffull course of software engineering mid term.pdf
full course of software engineering mid term.pdfAbdul salam
 
The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024Artur Skowroński
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxAS Design & AST.
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfkalichargn70th171
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive ReviewRevolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Reviewjw364beach
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxSasikiranMarri
 
logical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxlogical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxRemote DBA Services
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdfSteve Caron
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfmaor17
 
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...OnePlan Solutions
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?Alexandre Beguel
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 

Recently uploaded (20)

2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Business Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business AnalysisBusiness Analyzopedia - Your Pocket Gita for Business Analysis
Business Analyzopedia - Your Pocket Gita for Business Analysis
 
Santander Stream Processing with Apache Flink
Santander Stream Processing with Apache FlinkSantander Stream Processing with Apache Flink
Santander Stream Processing with Apache Flink
 
What is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docxWhat is Mendix and the concept of low-code development.docx
What is Mendix and the concept of low-code development.docx
 
Strategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero resultsStrategies for using alternative queries to mitigate zero results
Strategies for using alternative queries to mitigate zero results
 
full course of software engineering mid term.pdf
full course of software engineering mid term.pdffull course of software engineering mid term.pdf
full course of software engineering mid term.pdf
 
The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024The State of the Green IT at the beginning of 2024
The State of the Green IT at the beginning of 2024
 
Mastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptxMastering Project Planning with Microsoft Project 2016.pptx
Mastering Project Planning with Microsoft Project 2016.pptx
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdfPros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
Pros and Cons of Selenium In Automation Testing_ A Comprehensive Assessment.pdf
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive ReviewRevolutionize Your Video Editing with InVideo.io: A Comprehensive Review
Revolutionize Your Video Editing with InVideo.io: A Comprehensive Review
 
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptxUnderstanding Plagiarism: Causes, Consequences and Prevention.pptx
Understanding Plagiarism: Causes, Consequences and Prevention.pptx
 
logical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptxlogical backup of Oracle Datapump-detailed.pptx
logical backup of Oracle Datapump-detailed.pptx
 
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
[ CNCF Q1 2024 ] Intro to Continuous Profiling and Grafana Pyroscope.pdf
 
Zer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdfZer0con 2024 final share short version.pdf
Zer0con 2024 final share short version.pdf
 
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
Transform your Corporate Strategy Office - Harness OnePlan’s Strategic Portfo...
 
SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?SAM Training Session - How to use EXCEL ?
SAM Training Session - How to use EXCEL ?
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 

Hands on Exploration of Page Objects and Abstraction Layers with Selenium Webdriver Workshop Slides

  • 1. Hands on exploration of Page Objects and Abstraction Layers with Selenium WebDriver A Half Day Tutorial Alan Richardson @eviltester alan@compendiumdev.co.uk www.SeleniumSimplified.com www.EvilTester.com www.CompendiumDev.co.uk www.JavaForTesters.com
  • 2. 2 Blogs and Websites ● CompendiumDev.co.uk ● SeleniumSimplified.com ● EvilTester.com ● JavaForTesters.com ● Twitter: @eviltester Online Training Courses ● Technical Web Testing 101 Unow.be/at/techwebtest101 ● Intro to Selenium Unow.be/at/startwebdriver ● Selenium 2 WebDriver API Unow.be/at/webdriverapi Videos youtube.com/user/EviltesterVideos Books Selenium Simplified Unow.be/rc/selsimp Java For Testers leanpub.com/javaForTesters Alan Richardson uk.linkedin.com/in/eviltester Independent Test Consultant & Custom Training Contact Alan http://compendiumdev.co.uk/contact
  • 3. After gaining some experience of web automation tools, you start to realise that “yes, you have to learn the API”, but the real challenge is modeling the application and building an abstraction layer which supports different approaches to automation. And when we build an abstraction layer, we have lots of options to choose between. 3 ● Do you use the Page Factory? ● What counts as a page object? ● Should a page object offer logical functions like “loginAs” or does it only model the physical world? ● How do we deal with navigation? Return page objects, or with a different set of objects? ● Do we need abstractions for Dom elements like input fields or is WebElement enough? ● When do we synchronise with WebDriverWait and when do we use SlowLoadableComponent? ● Should we build our own abstractions on top of SlowLoadableComponent? By using a simple web application, we will use these, and other questions, to discuss and experiment with, the most challenging parts of Web Automation – the modeling and construction of robust and re-usable abstraction layers. Existing practitioners, be prepared to discuss the choices you have made in the past, what worked, and what didn’t, so that we can learn and possibly build on some of those decisions. This is open to novices and experienced practitioners, but if you want to take part then make sure you have a functioning Selenium WebDriver installation. All examples will be presented using Java, but that doesn’t stop you writing experiments in Python, .Net, or whatever other language you favour. Bring your laptop, and you’ll have the opportunity to explore different ways of building Page Objects and abstraction layers.
  • 4. 4 Logistics & Plan ● 11:00 – 12:30 == 1.5 – Intro – General Abstractions Overview – Example Implementations & Discussions – Exercise (till lunch) ● Given some scenarios, create some tests and abstraction layers to support your tests ● 13:30 – 15:00 == 1.5 – Continue exercises and debrief – Examples and Comparison with group – Exercise (till end) ● Adjust your code, refactor to other approaches
  • 5. 5 Code Examples & Slides ● http://unow.be/at/letstest2014sweden ● https://xp-dev.com/svn/AutomationAbstractions ● http://unow.be/at/letstest2014sweden
  • 6. 6 Experiences Check ● Used WebDriver? ● What Languages? ● Abstraction Layers? ● Frameworks? ● Current setup – Laptop With You? – Ready to code?
  • 8. “I must create a system. or be enslav'd by another Mans; I will not reason & compare: my business is to create” 8 William Blake, Jerusalem: The Emanation of the Giant Albion http://www.blakearchive.org/exist/blake/archive/object.xq?objectid=jerusalem.e.illbk.10&java=no
  • 9. 9 What is Abstraction? ● Discuss
  • 10. 10 Abstraction ● Modelling ● Separation of concerns ● Logical vs Physical ● Functional vs Structural ● Interfaces vs Implementations ● Data / Entities / Persistence ● Functionality / Task Flow ● Goals / Strategies ● Layers – GUI, DB, HTTP ● Etc.
  • 11. 11 Example Test Without Abstraction @Before public void startDriver(){ @Test public void canCreateAToDoWithNoAbstraction(){ driver.get("http://todomvc.com/architecture-examples/backbone/"); int originalNumberOfTodos = driver.findElements( By.cssSelector("ul#todo-list li")).size(); WebElement createTodo = driver.findElement(By.id("new-todo")); createTodo.click(); createTodo.sendKeys("new task"); createTodo.sendKeys(Keys.ENTER); assertThat(driver.findElement( By.id("filters")).isDisplayed(), is(true)); int newToDos = driver.findElements( By.cssSelector("ul#todo-list li")).size(); assertThat(newToDos, greaterThan(originalNumberOfTodos)); } driver = new FirefoxDriver(); } @After public void stopDriver(){ driver.close(); driver.quit(); } NoAbstractionTest.java
  • 12. 12 Example Test With Abstraction @Before public void startDriver(){ @Test public void canCreateAToDoWithAbstraction(){ TodoMVCUser user = new TodoMVCUser(driver, new TodoMVCSite()); user.opensApplication().and().createNewToDo("new task"); ApplicationPageFunctional page = new ApplicationPageFunctional(driver, new TodoMVCSite()); assertThat(page.getCountOfTodoDoItems(), is(1)); assertThat(page.isFooterVisible(), is(true)); } driver = new FirefoxDriver(); } @After public void stopDriver(){ driver.close(); driver.quit(); } NoAbstractionTest.java
  • 13. 13 Why Abstraction? ● Change implementations ● Single Responsibility – only changes when necessary ● Makes automation readable and maintainable
  • 14. “...The name of the song is called ‘Haddocks' Eyes.’” “Oh, that's the name of the song, is it?" Alice said, trying to feel interested. “No, you don't understand,” the Knight said, looking a little vexed. “That's what the name is called. The name really is ‘The Aged Aged Man.’” “Then I ought to have said ‘That's what the song is called’?” Alice corrected herself. “No, you oughtn't: that's quite another thing! The song is called ‘Ways And Means’: but that's only what it's called, you know!” “Well, what is the song, then?” said Alice, who was by this time completely bewildered. “I was coming to that,” the Knight said. “The song really is ‘A-sitting On A Gate’: and the tune's my own invention.”” 14 Lewis Carroll, Through The Looking Glass
  • 15. 15 Common Abstraction Approaches
  • 16. 16 Abstraction Layers Categorised 1) Data – Generic Data Abstractions e.g. email, postcode 2) Physical – Physical layout of your application e.g. pages, components – Navigation across pages 3) Domain – Your application Entities domain e.g. user, account 4) Logical – User actions, workflows
  • 17. 17 Common Automation Abstractions ● Page Objects ● Element Abstractions: select, textbox, etc. ● Domain Objects ● Gherkin (Given/When/And/Then) ● Domain Specific Languages ● Any More? – Create a List to discuss – Any public examples? – Any examples in the room that can be shared?
  • 19. 19 Abstraction != Implementation ● Abstraction != Tool / Framework / Implementation ● Gherkin != Cucumber ● Page Object != Page Factory ● DSL != Keyword Driven If we want to get good at abstraction then we need to model, split apart, and make the relationships clear
  • 20. 20 WebDriver as an Abstraction Layer ● Dom Abstraction – WebElement ● Browser Abstraction – WebDriver ● FireFox, Chrome, Remote etc. ● HTML Abstractions – Cookies, Frames, etc. ● 'Support' classes augment WebDriver – e.g. com.seleniumsimplified.selenium.support
  • 21. 21 Model the application under test
  • 22. 22 Given an App – todomvc.com
  • 23. 23 TodoMVC.com Functional Overview Demo ● Single Page App ● Shows Counts ● Data held in HTML5 local storage ● Create/Edit/Complete a 'todo' ● Clear Completed ● Filter active/completed/all ● Delete a todo
  • 24. 24 Exercise Given an App – todomvc.com ● What Abstractions might we build? ● What thoughts do we have? ● What underpins our analysis? ...Then Debrief
  • 26. 26 Page Objects ● The most obvious automation abstraction ● What is it? – A page? A Component? ● Experiences? ● Do web applications still have pages?
  • 27. 27 Page Object Design Decisions ● What methods does it have? – Functional ● login(username, password), ● loginAs(user) – Structural ● enterName(username), enterPassword(password), clickLogin(), submitLoginForm(username, password) ● Does it expose elements or not? – public WebElement loginButton; – public WebElement getLoginButton(); – public clickLoginButton();
  • 28. 28 Navigation Design Decisions ● Does a Page Object return other pages? public IssueListPage submit(){ driver.findElement(By.id(“submit”)).click(); return new IssueListPage(driver); } ● Pros? ● Cons? ● Experiences
  • 29. 29 Page Objects ● What rules / guidelines / biases do you use for page objects?
  • 30. 30 Implementing Page Objects ● POJO – Plain object, driver in constructor, methods use driver.<method> ● Page Factory – Annotated elements, lazy instantiation via reflection ● LoadableComponent – Common interface (load, isLoaded), isLoaded throws Error ● SlowLoadableComponent – Common interface, waits for on isLoaded ● Other approaches?
  • 31. 31 Implicit or Explicit Wait? ● Implicit Wait driver.manage().timeouts(). implicitlyWait(15L, TimeUnit.SECONDS); assertThat(driver.findElement( By.id("filters")).isDisplayed() , is(true)); ● Explicit Wait driver.manage().timeouts(). implicitlyWait(0L, TimeUnit.SECONDS); WebDriverWait wait = new WebDriverWait(driver,15); wait.until(ExpectedConditions.elementToBeClickable (By.id("filters"))); Example: 'NoAbstractionTest.java'
  • 32. 32 Exercise Automate Scenarios ● Create a ToDo (check: count, text) ● Can Delete a ToDo (check: footers, count) ● Can Mark a ToDo as completed ● Can create a bunch of ToDos and delete, mark as complete etc. ● Add additional checks as required ● Create Abstraction layers as appropriate ● We will discuss your compare your examples with the group and the examples
  • 34. 34 POJO ● 'ApplicationPage.java' – Used in 'SequentialCreationOfTest.java' – Not much refactoring in the example ● Simple Class ● WebDriver passed to constructor ● Composition of any components
  • 35. 35 POJO Discussion ● Pros ● Cons
  • 36. 36 Functional vs Structural ● Compare 'ApplicationPage' with 'ApplicationPageFunctional' ● Functional – loginAs(username, password) ● Structural – enterUsername – enterPassword – clickLoginButton – submitLoginForm(username, password) ● Navigation – Should Page Objects return Page Objects?
  • 37. 37 Functional Vs Structural Example ● One way of answering “what methods to put on a page object” – Is it functional / behavioural? – Is it structural? ● Functional 'uses' Structural implementation ● See – com.seleniumsimplified.page.functionalvsstructural
  • 38. 38 Page Factory ● Compare ApplicationPageStructural with ApplicationPageStructuralFactory ● Annotate fields with @FindBy ● Instantiate in constructor using PageFactory.initElements – Can create your own page factory initialiser
  • 39. 39 Page Factory Example @FindBy(how = How.CSS, using="#todo-count strong") private WebElement countElementStrong; @FindBy(how = How.CSS, using="#todo-count") private WebElement countElement; @FindBy(how = How.CSS, using="#filters li a") List<WebElement> filters; @FindBy(how = How.ID, using="clear-completed") List<WebElement> clearCompletedAsList; @FindBy(how = How.ID, using="clear-completed") WebElement clearCompletedButton; public ApplicationPageStructuralFactory(WebDriver driver, TodoMVCSite todoMVCSite) { PageFactory.initElements(driver, this); this.driver = driver; ...
  • 40. 40 Page Factory Discussion ● Pros ● Cons
  • 41. 41 Loadable Component ● Extends LoadableComponent – Get ● If isLoaded, return this ● Else load() ● Check isLoaded() ● Implement load – Add any synchronisation in load to wait for the loading. Exit only when 'loaded'. ● Implement isLoaded – Check, and throw Error if not loaded
  • 42. 42 Loadable Component Example ● Compare ApplicationPageStructural with ApplicationPageStructuralLoadable
  • 43. 43 Loadable Component Discussion ● Pros ● Cons
  • 44. SlowLoadable Component Example 44 ● Extends SlowLoadableComponent ● Constructor has to additionally call – super(new SystemClock(), 10); – Where 10 is a timeout # of seconds ● get() – If isLoaded then return this Else load – While not loaded{ wait for 200 millseconds} ● Implement load and isLoaded – But can remove sync loops from load
  • 45. SlowLoadable Component Example 45 ● Compare ApplicationPageStructural with ApplicationPageStructuralSlowLoadable
  • 46. 46 SlowLoadable Component Discussion ● Pros ● Cons
  • 47. 47 Fluent Page Objects ● Methods return the page object or other objects – e.g. get() on LoadableComponent ● Instead of – void clickDeleteButton(); – PageObject clickDeleteButton(); ● Syntactic sugar methods: – and(), then(), also() ● Work well at high levels of abstraction – See SequentialCreationOfTestFluentSubset and ApplicationPageFunctionalFluent – Compare ApplicationPageFunctional with ...Fluent
  • 48. ● Direct in Test Navigation Options ● Instantiate new pages based on test flow 48 – Navigation as side-effect, may have to bypass 'get' – Loadable pages, non-loadable, support classes ● Page Object methods might return other Pages – e.g. a method on the login page might be ● MyAccountPage clickLogin(); – Returns a new page ● void clickLogin(); ● We might use navigation objects – direct, or Path based (current page → desired page) ● Navigate.to(MyAccountPage.class) ● Jump.to(MyAccountPage.class)
  • 49. 49 Possible Domain Abstractions ● Logical Objects – ToDo – ToDoList ● Physical Objects – LocallyStoredToDo ● Actors – User ● Environment – Site – Implementation
  • 50. 50 Page Objects & Domain Objects ● Instead of – todoMVC.enterNewToDo(“New Item”) ● We could have have – ToDoItem newItem = new ToDoItem(“New Item”); – todoMVC.enterNewToDo(newItem); ● Discuss ● See code in DomainBasedTest
  • 51. 51 Domain Objects That Span Logical & Physical e.g. User ● user.createNewToDo(“new item”) ● user.createNewToDo(newItem) ● Discuss ● See use in NoAbstractionTest
  • 53. 53 Element Abstractions ● Existing support: Select, ● Possible: TextBox, Checkbox, TextBox, File etc. ● Can enforce Semantics – Checkbox: isChecked, check(), uncheck(), toggle() – TextBox: clear(), enterText() – etc. ● Pass back from Page Objects into test? ● e.g. Checkbox in ElementWrapperTest – new CheckBox(driver, By); – new CheckBox(element)
  • 54. 54 Element Abstraction Examples public interface Checkbox { public boolean isChecked(); public Checkbox check(); public Checkbox uncheck(); public Checkbox toggle(); } ● Would you include 'toggle'?
  • 55. Element Abstraction Pros and Cons 55 ● May have to create a custom page factory ● Can help 'restrict' code i.e. check or uncheck, rather than click, enforces 'semantics' ● I make sure to return WebElement so that I can go beyond the abstraction layer if I need to. Not required if it is just a WebElement wrapper.
  • 56. 56 Component Abstractions ● Components on the screen – e.g. ComponentTest ● e.g. VisibleToDoEntry, Filters, Footer, Header, VisibleToDoList, etc. ● Could have 'functional' representation for repeated items e.g. login forms ● Could have 'structural' representation ● Likely use : page object composition
  • 57. 57 Component Abstraction Example page.getToDoEntryAt(todoMVC.getCountOfTodoDoItems()-1). markCompleted(); ● See 'ComponentTest.java' – ApplicationPageStructuralComponents (compare with ApplicationPageStructural – VisibleToDoEntry ● (this also uses Element Abstraction)
  • 58. 58 Gherkin as an abstraction layer Feature: We can create and edit To Do lists in ToDoMvc We want to amend todos in ToDoMVC because that is the set of exercises on the abstraction tutorial Scenario: Create a ToDo Item Given a user opens a blank ToDoMVC page When the user creates a todo "new task" Then they see 1 todo item on the page ● Implement steps using highest appropriate abstraction layer ● CucumberJVM as 'DSL implementor' ● 'Expressibility' vs 'Step Re-use' ● See todomvc.feature and ToDoMvcSteps
  • 59. 59 Additional Debrief ● Did anyone do anything different? ● Any other abstraction approaches you used? ● Anything else to add?
  • 60. 60 Final Exercise Section ● Continue to automate the site ● Build abstraction layers to cover the functionality ● Experiment with additional approaches mentioned that you haven't used ● Or, use code and amend and experiment
  • 62. 62 My bias model has Driver as core ● Driver – Build around that so instantiate any page or component as required at any time ● Synchronisation – To make sure that the desired object is available and ready for use (as defined by synchronisation) ● Navigation – Implicit (via actions) – Explicit ● Open/jump (via driver.get) ● To (state model from current, to desired)
  • 63. 63 Biases ● Examine some common biases and discuss pros/cons based on experience
  • 64. 64 Are there rights and wrongs? ● Right / Wrong? ● Decisions? ● Project/Team/Organisation Standards?
  • 65. 65 Should we add asserts into abstraction layers? ● e.g.
  • 66. Should Page Objects consume and 66 return domain objects? ● e.g. – loginAs(user) – List<User> getUsersList()
  • 67. 67 Should Page Objects return WebElements?
  • 68. 68 Decisions ● The 'limits' and overlap of Abstraction Layers ● Build it now, or 'refactor to' later ● How much change is anticipated? – To which layer? GUI, Business domain, Workflow? ● Who is working with the automation code? – Skill levels? Support needed? ● How/When with the automation execute?
  • 69. 69 Decisions ● The 'limits' and overlap of Abstraction Layers ● Build it now, or 'refactor to' later ● How much change is anticipated? – To which layer? GUI, Business domain, Workflow? ● Who is working with the automation code? – Skill levels? Support needed? ● How/When with the automation execute?
  • 70. 70 “To the creative mind there is no right or wrong. Every action is an experiment, and every experiment yields its fruit in knowledge.” The Illuminatus Trilogy Robert Anton Wilson
  • 71. 71 Other Useful Links ● Jeff “Cheezy” Morgan – page-object ruby gem, data_magic gem and stareast code – https://github.com/cheezy?tab=repositories ● Marcus Merrell – Self-Generating Test Artifacts for Selenium/WebDriver – https://www.youtube.com/watch?v=mSCFsUOgPpw
  • 72. 72 Blogs and Websites ● CompendiumDev.co.uk ● SeleniumSimplified.com ● EvilTester.com ● JavaForTesters.com ● Twitter: @eviltester Online Training Courses ● Technical Web Testing 101 Unow.be/at/techwebtest101 ● Intro to Selenium Unow.be/at/startwebdriver ● Selenium 2 WebDriver API Unow.be/at/webdriverapi Videos youtube.com/user/EviltesterVideos Books Selenium Simplified Unow.be/rc/selsimp Java For Testers leanpub.com/javaForTesters Alan Richardson uk.linkedin.com/in/eviltester Independent Test Consultant & Custom Training Contact Alan http://compendiumdev.co.uk/contact
  • 73. 73 Notes: Install app locally ● https://github.com/tastejs/todomvc/commit/f57e0b773db14f094ef09274af90042f83328412 ● https://github.com/tastejs/todomvc/archive/f57e0b773db14f094ef09274af90042f83328412.zip ● Point Site url to file:// location unarchive and run tests – absolute links won't work without a server