In This Course

Did you know that a recent poll revealed that 80% of QA Automation Engineers cannot run more than 100 functional tests daily, with 95% reliability? Furthermore, over 50% of these Automation Engineers struggle to run between 0 – 50 automated functional tests per day!

Functional test automation is a hard job. However, you can make your job much easier by learning a pattern known as the Page Object Pattern. The Page Object Pattern helps to resolve a lot of the problems that other automation techniques cannot. Making your test automation more stable as a result.

This course is designed to teach you how to properly code the Page Object Pattern using Selenium Webdriver with C#.

However, all of the information here is equally applicable to any other functional testing tool because the Page Object Pattern is a universal principle that makes test automation more robust. Similar to other universal concepts such as Don’t Repeat Yourself or Single Responsibility Principle.

Therefore, if you know Object Oriented programming and a different functional automation tool, you can still comfortably follow along with all of the principles and patterns that I lay out in this course.

In this course, you will learn:

– Why other methods such as Record & Replay or Keyword Driven do not work when it comes to test automation

– What the Page Object Pattern is in automation

– Advantages and disadvantages of the Page Objects

– Amazing tips and tricks on how to:

  • Implement the Page Objects using Selenium Webdriver
  • Improve your Page Objects to follow DRY Principle
  • Improve Page Objects to follow SRP Principle
  • Create amazing Page Objects for gigantic web pages

Free Video Course

In This Lecture

In this video, we will go through the analysis of ObjectRepository Implementation.

Selenium Tutorial – Analysis of ObjectRepository Implementation

 

So let’s dip into the base page class and analyze what’s going on exactly and how we implemented this new object repository. And don’t worry the first one I implemented it just so I can show you and explain to you everything. And then we’re going to go through and implement this for the rest of the pages so that you can better understand how to do this.

So I’m going to step into the base page class. And you can see that the base page class is initialized with a dynamic type of type Object repository. And that we’re utilizing a constraint where I’m saying that the object repository needs to be over type base page object repository. So if we go into the base page object repository you can see that it just going to store the reference to a driver. So whenever it gets initialized you just have to pass in the driver. And then there’s going to store it so that it can use the driver for all of its object repository classes.

So let’s go back here. So when we are initializing our base page with a dynamic type of type Object repository we can call our base page constructor. And our base page constructor is going to take a drive or type which it has always been taking before. And now it’s also going to take a dynamic type of repository this repository. Of course, has to be has to implement the base page object repository. So that means you can have many different kinds of repositories. And as long as they implement the base page object repository they are going to work.

And so that object that we pass in gets assigned to our object repository variable that we have in our class and then now we can use this object repository property to access the dynamic object repository that we pass. Then let’s go back to the courses specially you can see all of that again.

So, of course, this page inherits from a base page and it initializes a courses page object repository see this is the dynamic type here. Each of our page objects that inherit from the base page are going to have their own object repository so that they can access the appropriate objects from that object repository that are relevant only to that page. So this one is a courses page object repository. So if I navigate to courses page object repository you can see that now we have the element that we used to have in the courses page.

It leaves in the object repository and it just has a simple constructor that initializes the base page object repository to passing the driver. And then we utilize that driver within our child page our child object repository.

It’s that simple. So again we initialized it with a coarse page object repository. Whenever this page is created it’s going to go ahead and initialize our base page class. it’s going to initialize the base page class by passing into values of value for the driver and create a new instance of the dynamic type of object repository. When we’re creating that dynamic type it simply gets assigned to the object repository which can be any type. And now we can utilize it for dealing with our objects. And be utilized for dealing with objects in this manner.

Will you just call the object repository which just lives in the base page class. You can use the dot notation. And now you’re going to have access to all of the objects that live inside of that object repository making it way easier to know which objects you can. And interact with as opposed to scanning the entire class visually and trying to remember what is available inside of that class what elements are available for you to play with.

Let’s proceed because I know this might be extremely confusing. Let’s go ahead and implement this for another page. And I am 100 percent confident that you will understand this by the time we’re done implementing this on all of the pages

Pin It on Pinterest

Shares
Share This