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.

Advertisements

One thought on “Why to apply Page Object Model in automation frameworks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s