The Trouble with Page Objects – Things you always knew were wrong but couldn’t explain why
PageObjects have some common problems that many people see but not everyone can explain. Over time they can become harder and harder to maintain. In some cases, they become a tangled mess riddled with deep inheritance hierarchies. How can this happen?!
PageObjects provide an easy-to-follow, simple structure that avoids early maintenance issues. But, they break some key OO design rules, making maintenance more difficult over time. This can result in flaky tests. PageObjects were introduced to help test-developers avoid mistaking flaky tests for problems with Selenium. It was a useful first step, so why did we stop there?
In this session you’ll learn about the SOLID design principles that PageObjects disregard. You'll see why this leads to problems. You’ll see how and why PageObjects benefit from refactoring to SOLID design principles. Finally, you’ll meet the Screenplay Pattern; an alternative that can save you the effort.
Outline/structure of the Session
The talk will include several easy-to-follow code examples, telling the story as follows:
- Some history on Page Objects
- What are the common problems people encounter?
- How do they become harder and harder to maintain?
- A typical PageObject example
- What is SOLID and why does it matter?
- What are some common ways that PageObjects violate SOLID principles?
- How to refactor PageObjects towards SOLID principles.
- How a task-centric domain model increases flexibility.
- The Screenplay pattern – PageObjects refactored.
- Non technical attendees will recognise some of the challenges their colleagues face and have takeaways they can use, such as the task-centric domain model.
- Beginners will learn what to expect as their test projects grow and where to begin when they encounter problems.
- Intermediate and beyond will understand the common problems of using the Page Object Model in greater depth and some practices to deal with them.
- Everyone will enjoy an energetic and fun presentation that for some may challenge the status quo in an enlightening way.
Testers, SDETs, Developers, Business Analysts, Architects
schedule Submitted 2 years ago
People who liked this proposal, also liked:
Andy Palmer - Robot Handles - Giving Selenium a Helping HandAndy PalmerRiverGliderRiverGlide
schedule 2 years agoSold Out!
By far the most common way to use Selenium to interact with an application is to code tests that have intimate knowledge of the underlying application. This is simple, but brittle. Others may try to make the test code intelligent, leading to a very complex testing framework. There is a middle ground.
Imagine that we are building a robot to move eggs. A simple robot can deal with identical eggs, but is brittle as soon as new eggs are introduced. An intelligent robot could adapt to variations with sensitive touch sensors. Or, we could use egg-holders with a handle on top. Now all we need is a simple robot that understands handles. If we then want to move something instead of eggs, we just need a new holder – the handles and the robot remain the same.
In this session you’ll learn the metaphor of Robot Handles, discuss ways that we can add meaningful interaction metadata into the application as we build it, and demonstrate how that can be just as helpful for humans as it is for robots