4

I never had to test an application with Page Object Model, so trying to study up on that. Questions:

  1. Is it true that it is only used when you need to enter different sets of data into the same edit field multiple times?

  2. Is it true that in fact there are more applications that don't use POM than applications that do?

  3. Do I understand it right that POM can be implemented without Page Factory and if so, when is it worth using Page Factory?

1
  • Voting to close as too broad. Have you considered asking each question separately?
    – dzieciou
    Dec 23, 2016 at 10:09

2 Answers 2

2

1.a) You always should expect to use actions like entering a value to a field multiple times - software should be reusable. Three Strikes And You Automate - and in situation like this, you may apply Zero One Infinity Rule.

1.b) Separation of concerns: page knows about locators, but your test does not care about them.

2) If you apply Pareto principle, 80% of anything is crap (and such code might not use POM).

3) Depends of language. I use Python, and am doing fine without factories for either elements or pages.

2

Q. Is it true that it is only used when you need to enter different sets of data into the same edit field multiple times?
A. No. That is the advantage that most programmers point to first. The other reason for using a page object is to have tests written fully in plain english, including the element selectors and for me that is actually the main reason. With today's editors I can globally search and replace easily, but adding meaning by describing the element in plain English is something that requires a human brain.

Q. Is it true that in fact there are more applications that don't use POM than applications that do?
A. This is really unknowable without surveying hundreds or thousands of companies. All I can really say is that for small new companies it may not be used but for larger companies with more complex applications it quickly becomes a common pattern to aid in maintainability.

Q. Do I understand it right that POM can be implemented without Page Factory and if so, when is it worth using Page Factory?
A. Yes, you don't need a Page Factory. You use one when there is a lot of functionality that can be broken down and shared and you want to avoid repetition.

I have implemented the Page Object pattern in many different ways, including

  • Simple variables, defined in one file
  • A class with a method for each element that need to be identified and used
  • A yaml file that contains key-values pairs, key=name_description, value=element_identifier

so as you can see, the concept that this is a specific object pattern is not really true as it now exists in many forms.

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