Leveraging automated verification code patterns
Just like with any other code, we can apply standard code patterns to our verification code in order to improve our code's structure or maintainability. As detailed in the previous sections of this chapter, we can minimize our verification code's brittleness by having our step definition code reflect an operational level of knowledge, rather than the nitty-gritty technical details. We will achieve that by using two tried and tested code patterns, the Page Object and the Façade. Let's look at the Page Object first.
Hiding browser details with the Page Object pattern
The Page Object pattern is a way to represent HTML pages and their elements in reusable classes. Page Objects provide an abstraction that allows us to write browser-interaction code that is reusable and maintainable. It works like this:
- We create a Page Object for each web page our operational workflow uses. The object has methods that represent...