Automation, Automation Framework, Design Pattern, Design patterns, Page Object Model, Testing, Web Automation

Part II – One step deeper into Page Object Model.

As we have already discussed in my last post on page object model, why we need design patterns while coding. In this post, lets see what all pre-requisites are required to get a quick start so that we can get a better understanding of POM aka Page Object Model:

  1. The functionality classes (PageObjects) represent a reasoned common lineage between the pages of the application.
  2. The Page Object pattern act for the screens of your web app as a sequence of objects.
  3. It encapsulates the characteristics represented by a page.
  4. It permit us to mock-up the UI in our tests.
  5. A page object is an object-oriented class that work as an interface to a page of your AUT.

Continue reading “Part II – One step deeper into Page Object Model.”

Advertisements
Agile Testing, Automation, Design patterns, Functional Testing, Java, Page Object Model, Quality Analyst, Selenium, Testing, Web Automation, Web Testing

Why to apply Page Object Model in automation frameworks.

Today I will share how and why we can apply design pattern concepts while creating a new framework. Lets try and understand why we need any design pattern in our project. No doubt we can make a framework be it automation or any feature specific project but if we talk about a big Enterprise edition project then we have to think of factors like optimal solutions, performance, maintainability etc. Similarly we can directly use the play-records plugin of Selenium and start applying further concepts over it. Then why people are not utilizing it ? Moreover inclination is more towards Selenium webdriver whole-some project. Let us see what all factors attract a user to use Selenium Webdriver instead of the fact that Selenium IDE can generate automation code in any of your favorite language like Java, etc

  1. Code is rigid.
  2. You can make classes out of the code but not any framework.
  3. You have to certainly perform the record and play option again and again if any test case fail.
  4. This idea will definitely give you a piece of code but not a project on which you can rely upon.

Lets understand this with a picture, it would be difficult for this guy to find a way. But it would be much easier if something like this might happen to him.

Make sense, yeah…err…no!! Ok. What I mean is if we can specify directly that what path to take and when, then it might help the reader to understand better, as simple as this. Design patterns also helps us in doing the same stuff for our code, so that we can arrange our code snippets, classes, packages, etc in such a manner that it would help in making code more readable, understandable and manageable.

Advantages of page object pattern:

  1. Makes tests more readable and robust.
  2. Bring down the duplication of code.
  3. Improves the maintainability of tests, remarkably when there is frequent change in the AUT. (Useful in Agile methodology based projects).
  4. Simple and clear tests.
  5. Good support of tests, because everything is stored in one place.
  6. Easy creation of new tests. In fact, tests can be created by a person not knowing the features of automation tools.
  7. The UI changes, the fix need only be applied in one place.
  8. Code re-use: Able to use the same page object in a variety of tests cases.

In the coming blog I will be discussing how we can apply this Page Object Concept in Selenium scripts.