5

I have a web application which has around 500 pages. Can we use POM framework and if so, is it a good practice? if not, please suggest some ideas.

  • 2
    The automation code derives primarily from the problem you are trying to solve: the tests, not the target of the tests. Could you elaborate on what type of flows are you trying to used automation on: What is the context of the product? What are your resources? What is covered with other levels of automation? How did you find this number of pages? – João Farias May 16 at 6:45
  • The website different categories and services offered to customers. Each information page has charts/graphs, PDFs and links that navigate to a single micro site. The testing involves validating minor changes to each page but all are unique change. – Harish Kannan May 16 at 7:10
5
  • THINK BIG; We are going to automate everything! I am so excited!
  • act small; Automate a single user flow. (Not login, but a real end-to-end behaviour, login might be part of this.)
  • Fail fast; Struggle...
  • Learn rapidly; Retrospect, inspect and adapt, decide on the next experiment and goto act small.

I love simple PageObjects as pattern. Not as a "framework". Page Object Models and Factories are probably over-engineering. During your struggles and learning decide if you want to go bigger with more complexity in your framework.

It won't be perfect from the start. Every domain, industry and team has different needs, so there is not standard or silver bullet. Iterate, while improving continuously and rigorously.

Test-code is code. Use practises/patterns like PageObjects, DRY, CleanCode, Solid, etc...

A few years ago I asked a similar question: Does the Page Objects pattern scale? I think it does. Once you have enough pageObjects, writing new test-cases for existing views becomes so easy.

8

Well, first I would ask these questions:

  • Do you really need to write Selenium test for all of these 500 pages?
  • Do your developers write enough and good Unit tests?

I assume it is a Single Page Application and for sure there are so many common components between these 500 pages i.e they are not 500 unique pages with completely different behaviours and functionality.

I recommend to follow the Test Pyramid and make a list of test cases which are not covered by low level tests. Then go with any solution/design which are scalable, fast and not flaky and easy to configure & maintain (for example puppeteer).

1

As a simple answer to your question: Page Objects scale well.

And more on the guidance side of things...

Should you be testing 500 variations on the same pages using 500 unique page objects? No, probably not.

A set of pages that allow tests to check what features are enabled on the page at a given time would be a more sensible way to handle this. E.g.

productPage.checkFeatureYIsEnabled();
productPage.checkFeatureXIsDisabled();

Small text differences are also easily checked in this manner

productPage.checkFeatureYHasTitle("Customised text");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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