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.
-
2The 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 FariasMay 16, 2019 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 KannanMay 16, 2019 at 7:10
3 Answers
- 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.
-
2This would be easy to remember as 'FLAT' - Fail fast, Learn rapidly, Act small, Think big - great answer!– dvnielMay 16, 2019 at 13:14
-
"Think big, act small, fail fast; learn rapidly" is a quote from the book "Lean Software Development: An Agile Toolkit." according to Wikipedia. en.wikipedia.org/wiki/Lean_software_development May 16, 2019 at 14:24
-
I use it because most people are stuck in thinking big :) May 16, 2019 at 14:24
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).
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");