SlideShare a Scribd company logo
Writing Maintainable,
Expressive Tests
with PageObjects
Michael Denomy
@mdenomy
About Me
• Senior Developer @TerribleLabs
• Practicing Agile for ~10 years
• @mdenomy on Twitter and gmail
• http://mdenomy.wordpress.com/
I ❤️ TDD
I ❤️ TDD
• Why?
I ❤️ TDD
• Why?
• Makes me a better developer
I ❤️ TDD
• Why?
• Makes me a better developer
• Keeps me thinking of behavior before
implementation
I ❤️ TDD
• Why?
• Makes me a better developer
• Keeps me thinking of behavior before
implementation
• TDD, BDD, more or less the same for me
I ❤️ TDD
• Why?
• Makes me a better developer
• Keeps me thinking of behavior before
implementation
• TDD, BDD, more or less the same for me
• It’s not about testing…..
Well-Factored Tests
• Tests should follow same principles as
application code
• Expressive
• Well-factored
• DRY
What does it mean to be
DRY
• Don’t Repeat Yourself
• Actually it is OK to repeat yourself
• Just eliminate the duplication as part of your
Red-Green-Refactor workflow
What are Page Objects
• Wraps an HTML page in an
application DSL
• Allows us to write
acceptance tests using
application language
• HTML specific bits are kept
in one place
• Tests are less brittle
http://martinfowler.com/bliki/PageObject.html
Let’s look at some code
• Denomy’s Wine Emporium
• https://github.com/mdenomy/foundation-demo
• Originally written to play around with Zurb Foundation’s grid system,
but threw in some tests with PageObjects for this talk
• To see the overall workflow check out these branches in the
following order
• manager-adds-event
• introduce-page-objects
• events-on-homepage
• order-events
• limit-events-on-homepage
• base-page-object
Let’s look at some code
User Story - Manager Creates Events
As a store manager, I want create
events that will be shown on the home
page, so that people visit the store and
buy lots of wine
Summary
• Abstract the implementation of an HTML page
away from your tests
• Write your acceptance tests around application
behaviors
• Write tests with the same focus on quality as
application code
References
• http://martinfowler.com/bliki/PageObject.html
• http://robots.thoughtbot.com/better-acceptance-
tests-with-page-objects
• https://code.google.com/p/selenium/wiki/
PageObjects
Writing Maintainable,
Expressive Tests
with PageObjects
Michael Denomy
@mdenomy

More Related Content

What's hot (20)

PPTX
Kentico Cloud Best Practices
Kentico Software
 
PPTX
Angular – Say Goodbye to Javascript Soup
Graeme Foster
 
PPTX
Untangling - fall2017 - week6
Derek Jacoby
 
PPTX
The WordPress REST API as a Springboard for Website Greatness
WP Engine UK
 
PPTX
Rakshat bhati
Rakshat bhati
 
PDF
Rock Your Blocks! Web Design Acceleration with Genesis Pro
WP Engine
 
KEY
DM 250 Week 1 - The Internet, XHTML, & CSS
Joel G Goodman
 
PPTX
Importance of Content Writing & Marketing for Plugin Developers
Vishal Kothari
 
PPTX
Doing Modern Web, aka JavaScript and HTML5 in the Enterprise NYC Code Camp
Chris Love
 
PDF
The Fast Track to Mastering Modern WordPress - Rob Stinson & Carrie Dils
WP Engine
 
PPTX
Bootstrap Lightning Talk
jeremyk23
 
PDF
From WordPress Configurator to WordPress Developer
Ken Toh
 
PPTX
Untangling - fall2017 - week 7
Derek Jacoby
 
PDF
Between a Block & a Hard Place
WP Engine
 
PPTX
Portfolio
Siva Ram
 
PPSX
WordCamp Pokhara - Contributing to the WordPress Repository in a smart Way
Mizanur Rahaman Mizan
 
PDF
Develop:BBC 2013 - Turbocharge your mobile web apps by using offline
Jan Jongboom
 
PPTX
WordCamp Kent 2019 - WP 101: Local Development - Themes and Plugins
Joe Querin
 
PDF
How To Work Faster & More Profitably With Client Site Starter Templates
WP Engine
 
PDF
Byowwhc43
Shannon Gallagher
 
Kentico Cloud Best Practices
Kentico Software
 
Angular – Say Goodbye to Javascript Soup
Graeme Foster
 
Untangling - fall2017 - week6
Derek Jacoby
 
The WordPress REST API as a Springboard for Website Greatness
WP Engine UK
 
Rakshat bhati
Rakshat bhati
 
Rock Your Blocks! Web Design Acceleration with Genesis Pro
WP Engine
 
DM 250 Week 1 - The Internet, XHTML, & CSS
Joel G Goodman
 
Importance of Content Writing & Marketing for Plugin Developers
Vishal Kothari
 
Doing Modern Web, aka JavaScript and HTML5 in the Enterprise NYC Code Camp
Chris Love
 
The Fast Track to Mastering Modern WordPress - Rob Stinson & Carrie Dils
WP Engine
 
Bootstrap Lightning Talk
jeremyk23
 
From WordPress Configurator to WordPress Developer
Ken Toh
 
Untangling - fall2017 - week 7
Derek Jacoby
 
Between a Block & a Hard Place
WP Engine
 
Portfolio
Siva Ram
 
WordCamp Pokhara - Contributing to the WordPress Repository in a smart Way
Mizanur Rahaman Mizan
 
Develop:BBC 2013 - Turbocharge your mobile web apps by using offline
Jan Jongboom
 
WordCamp Kent 2019 - WP 101: Local Development - Themes and Plugins
Joe Querin
 
How To Work Faster & More Profitably With Client Site Starter Templates
WP Engine
 

Similar to Writing Maintainable Tests with PageObjects (20)

PDF
Why use Go for web development?
Weng Wei
 
PDF
Getting started with dev tools (atl)
Thinkful
 
PDF
11 Amazing things I Learnt At Word Camp Sydney 2014
WordPressBrisbane
 
PDF
SEO for Visibility, Action, & Conversion
Cirrus ABS
 
PDF
Code stock
Erin Page
 
PPT
Web development | Derin Dolen
Derin Dolen
 
PDF
How Not to Be Conned by Your Drupal Vendor!
pixelonion
 
PDF
Writing clean and maintainable code
Marko Heijnen
 
PDF
How To Use Selenium Successfully (Java Edition)
Sauce Labs
 
PPTX
14 Habits of Great SQL Developers
Ike Ellis
 
PDF
Creating a Great Portfolio Site
Mel Choyce
 
PPTX
Software Engineering - Trends & Industry Practices
Alfred Jett Grandeza
 
PPTX
.NET executable requirements
Godfrey Nolan
 
PDF
Mastering Test Automation: How to Use Selenium Successfully
Applitools
 
PPTX
Do's and don'ts for Office 365 development
Chris O'Brien
 
PDF
Make your website work for you
Warren Denley
 
KEY
Driving application development through behavior driven development
Einar Ingebrigtsen
 
PDF
How to guarantee your change is integrated to Moodle core
Dan Poltawski
 
PPTX
WTF: Where To Focus when you take over a Drupal project
Symetris
 
PDF
Devconf 2011 - PHP - How Yii framework is developed
Alexander Makarov
 
Why use Go for web development?
Weng Wei
 
Getting started with dev tools (atl)
Thinkful
 
11 Amazing things I Learnt At Word Camp Sydney 2014
WordPressBrisbane
 
SEO for Visibility, Action, & Conversion
Cirrus ABS
 
Code stock
Erin Page
 
Web development | Derin Dolen
Derin Dolen
 
How Not to Be Conned by Your Drupal Vendor!
pixelonion
 
Writing clean and maintainable code
Marko Heijnen
 
How To Use Selenium Successfully (Java Edition)
Sauce Labs
 
14 Habits of Great SQL Developers
Ike Ellis
 
Creating a Great Portfolio Site
Mel Choyce
 
Software Engineering - Trends & Industry Practices
Alfred Jett Grandeza
 
.NET executable requirements
Godfrey Nolan
 
Mastering Test Automation: How to Use Selenium Successfully
Applitools
 
Do's and don'ts for Office 365 development
Chris O'Brien
 
Make your website work for you
Warren Denley
 
Driving application development through behavior driven development
Einar Ingebrigtsen
 
How to guarantee your change is integrated to Moodle core
Dan Poltawski
 
WTF: Where To Focus when you take over a Drupal project
Symetris
 
Devconf 2011 - PHP - How Yii framework is developed
Alexander Makarov
 
Ad

More from Michael Denomy (9)

PDF
Intro to automated testing
Michael Denomy
 
PPTX
Breathe In and Out With Me - Burlington Ruby Conference 2015
Michael Denomy
 
PDF
Memory Management in RubyMotion
Michael Denomy
 
PDF
Aikido, Controller Tests, and LinkedIn
Michael Denomy
 
PDF
Reinventing Yourself
Michael Denomy
 
PDF
Design Principles - Michael Denomy at Launch Academy
Michael Denomy
 
PDF
From Ruby on Rails to RubyMotion - Writing your First iOS App with RubyMotion
Michael Denomy
 
PPT
Debugging rails
Michael Denomy
 
PPT
Introduction to Test Driven Development
Michael Denomy
 
Intro to automated testing
Michael Denomy
 
Breathe In and Out With Me - Burlington Ruby Conference 2015
Michael Denomy
 
Memory Management in RubyMotion
Michael Denomy
 
Aikido, Controller Tests, and LinkedIn
Michael Denomy
 
Reinventing Yourself
Michael Denomy
 
Design Principles - Michael Denomy at Launch Academy
Michael Denomy
 
From Ruby on Rails to RubyMotion - Writing your First iOS App with RubyMotion
Michael Denomy
 
Debugging rails
Michael Denomy
 
Introduction to Test Driven Development
Michael Denomy
 
Ad

Recently uploaded (20)

PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
PDF
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
PPTX
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Advancing WebDriver BiDi support in WebKit
Igalia
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
July Patch Tuesday
Ivanti
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Reverse Engineering of Security Products: Developing an Advanced Microsoft De...
nwbxhhcyjv
 
OpenID AuthZEN - Analyst Briefing July 2025
David Brossard
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Advancing WebDriver BiDi support in WebKit
Igalia
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
July Patch Tuesday
Ivanti
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
New from BookNet Canada for 2025: BNC BiblioShare - Tech Forum 2025
BookNet Canada
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Go Concurrency Real-World Patterns, Pitfalls, and Playground Battles.pdf
Emily Achieng
 

Writing Maintainable Tests with PageObjects