4

I'm new with Selenium. Can you please explain What is Object Repository in Automation?
any example?

3

Object Repository is a centralized location where we can store objects information, it acts as interface between Test script and application in order to identify the objects during the execution.

We always recommend using external file for object repository rather than hard coding the objects and its properties directly into our code. If you are asking me why this is?
Reason is as it reduces the maintenance effort and provides positive ROI, for example say any of the object properties change within our application under test, we can easily change it in external object repository file, rather than searching and doing updates for that object individually in the code.

EX: we use a .properties file in Java

  • Agree, an object repository (or UI map) is much more maintainable as you only have to monitor 1 file. A disadvantage would be that file can grow into hundreds of lines depending on the app. I personally will take maintaining 1 file over tons of PageObjects though. – silver Jul 15 '18 at 13:05
3

I disagree about the usefullness of the object repository in Selenium WebDriver test automation projects.

In my opinion, using object repositories in Selenium projects is a bad practice.

The object repository concept comes from record-and-playback tools such as QTP.

The object repository is a tree-like structure that is created while recording a test.

It has attributes for each element of the page used in the test.

Selenium does not have any record-and-play feature for test automation (Selenium IDE is not an automation tool).

Using object repositories in Selenium projects (as property or csv or xml files) has many disadvantages such as

  1. since each locator is a line in a text file, it is impossible to open the declaration of the locator in the IDE (using F3 or Open Declaration)

  2. page object classes with no locator variables break the class encapsulation principle (methods of a class should execute on variables of a class)

  3. object repositories do not scale well for big pages; since big pages are bad and should be broken down in small pages, should we not have object repositories for each page widget?

  4. object repositories do not work with page factory

Read more about the disadvantages on this medium.com article.

  • 1
    i can use PO's in the selenium IDE. I've scaled page objects fine, breaking them out into individual and shared objects as needed. I just disagree with this answer. From my experience in 3 companies I think these are incorrect points – Michael Durrant Dec 29 '17 at 12:46
  • PageObjects are overrated and become huge maintenance overhead for large applications. I have seen test suites with 50+ page object classes and it is a nightmare. Most automation testers are not exactly developers which makes PageObjects notorious for terrible implementations. Partly the tester's fault but also alludes to the fact that it is not tester friendly and takes great effort to maintain. Sooner or later, you will find yourself mercilessly refactoring PageObjects just to keep up as the application grows larger. It is also very AUT-specific which makes it unusable for other projects. – silver Jul 15 '18 at 12:55
0

Object repositories are a collection of UI/Application object data recorded by the testing tool while exploring the application under test.

0

It's where you define objects (meaning the HTML definition of web page parts) and how they are grouped into application pages and page sections that represent logical groupings of information in the application.

See details here.

Think of a scenario where you have a Webpage and it has multiple sections, multiple frames and hundreds of WebElements. Obviously you do not want that once you type the page name and it will give you all the elements available on the webpage. If there are few elements, it is fine to have the same structure but if there are many then it is advisable to divide your page in to different sections for e.g. header, footer, left navigation, center content and right navigation. Then categories each WebElement under their parent element.

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.