Stewart Platt's Blog - Automated Testing - Page Objects

Automated Testing - Page Objects

I love Page Objects, however I dislike the name.

With the page object model, we encourage abstraction of the DOM (or whatever locators you might use for functional UI testing). This is a good thing (TM).

Unfortunately, the term Page Object doesn't convey the benefit of modelling applications at a more granular level. Code reuse and encapsulation does not begin and end with pages.

Rather, individual components should be modelled where appropriate. One should not rigorously apply DRY principles to plain English test cases (for Cucumber/Gherkin fans out there), but backing code sure as Hell warrants it.

If you've used page objects (or some similar abstraction), you're a cut above the rest, but please, don't take the name too literally. Feel free to model smaller components.

Please note: I am not advocating modelling the tests directly from the application code. In some cases, it does not make sense to model a component the same way the application does. So, don't go overboard.

tldr; model components, not pages

Comments