10

This question asks if the Page Objects pattern for automated GUI testing works for bigger projects. But as the question was focused on a single testing tool/framework I think its a good idea for a bit more general question.

We just started using the Page Objects pattern in a 4Mil LOC product and around 2000 views/pages.

This leads to the following question

  • What are the Pro's and Con's of the Page Objects pattern in large scale projects?
  • Anything you should keep in mind when setting up Page Objects for large scale projects?
2

1 Answer 1

6

In my opinion, yes, it does. However there isn't really a single way to implement this model that just works. You have to really think about the structure of your website in terms of it's pages, and figure out how you can represent that structure in your code.

For one company I worked for, I used the page object model against pages that were very simple such that each had a single state. This made it easy for a one class one page approach.

Another company had a website where it's page structure was more app-like that you had a single "super" page with many many states. Using this I created a framework that had a class hierarchy to roughly match the structure of the page states. Rather than a single class single page, I had each "component" that represented a state as it's own class and extended them appropriately. This way each component acted as a container for all it's own inner states, allowing a portion of the page to defined once, then extended wherever necessary.

Hope this helps!

1
  • 4
    That's the right point. PageObject can model not only whole page but also single components on a page, e.g., table grids.
    – dzieciou
    Jun 12, 2015 at 9:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.