In this video, Meaghan Lewis introduces the page object pattern and walks through an example of how to implement the page object pattern with a WebDriver test.
- [Narrator] One good design pattern for Selenium test…is to use the page object pattern.…This pattern involves setting up classes…for each page in the application…to model its behavior.…Each page class will be composed…of test selectors, and test methods.…In the test, a new page object is created,…and that object can then call that class's methods directly.…The goals of the page object pattern…are to have a separation of test and code.…It also helps to make tests more maintainable,…by being able to go directly to the page object class,…and update things there.…
Let's see how this pattern works in practice.…In our test, we have two pages we've interacted with so far.…There is the sign up page, and the users page.…Each one of those pages will have their own class.…I'll first create a page object class for signing up.…To do that, I'll go to my text editor,…and choose to create a new class called signup_page.rb.…Once I'm in my text editor,…I can start by creating a new class,…and I will save this as signup_page.rb.…
Find out how to set up the test-writing framework, WebDriver, and Selenium Grid, which allows you to distribute the testing load and run tests against a remote server. Learn best practices to write effective tests using variables and functions, and to organize tests into suites that can scale over time. Instructor Meaghan Lewis—a QA engineer at GitHub—also explains the test pyramid paradigm, which details an ideal way to balance unit, integration, and UI testing.
- Setting up Selenium WebDriver
- Using the Selenium grid to distribute the testing load
- Setting up a hub and nodes
- Writing clean test code
- Organizing a test suite