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
In This Lecture
Quiz answer to large page objects
So hopefully that wasn’t too bad for you. You’ve gotten practice with pretty much everything except abstracting out the actual little sections into their own classes. But the Rush should have been pretty easy for you if not it’s OK. You just need to practice more. That’s why I have the quizzes for you to be able to further improve your skills.
So let me show you what I did here. Of course I have data that test to use the center content. Let me show you my center content property returns me a new center content page. My center content page has a center content page object repository that’s going to contain all of the elements related to the center content which is the toggle.
So of course you have to truck out all the elements from the complicated page object repository into this page object repository. This makes your complicated page object a repository smaller and cleaner. Then of course my center content page has the standard methods for interacting with the toggle.
If we go back to the method there we’re using both of the methods that we had created before and they’re just going through the center content page nothing with change you just have to extract out everything into the appropriate page.
And now you can see how small our complicated page class-A is . With went from about 60 lines to about 25 lines of code and we’re utilizing composition by having all of the appropriate properties living inside of our complicated page class.
Now everything is easier to access in our tests . It is because we just go to the complicated page and then based on that we access the appropriate section. Then through that section we interact with the appropriate elements making our tests more readable.
Our classes smaller and easier to maintain and of course let me run this test for you just to make sure that it passes and for you if you just had different naming conventions of course that’s OK.
You don’t have to have the exact same naming conventions as me but I hope that the actual architecture of the classes and the creation of all object repositories in the elements was the same.
The only thing that could have differed for you was the naming conventions that you had for your properties and classes but there they should be pretty similar to mine as we were following pretty standard conventions throughout this entire course.
So you saw that the test passed and with that we are done cleaning up our complicated page objects making them smaller more readable and easier to maintain. Congratulations you have succeeded in achieving an entirely higher level of automated software testing with Page objects.
Nikolay Advolodkin is a self-driven SDET on a lifelong mission to create profound change in the IT world and ultimately leave a legacy for his loved ones, community, and the world at large. Today, he serves as the CEO and Test Automation Instructor at UltimateQA.com and contributes informative articles to leading test automaton websites like SimpleProgrammer.com and TechBeacon.com