How to Write Page Object Model Tests using Selenified

This video walkthrough demonstrates writing Page Object Model tests with Selenified 3.0, including how to use a ThreadLocal wrapper around the page object to make tests safe for parallel execution—where each thread gets its own class-variable instance rather than sharing a single, race-prone object.

Coveros Staff

September 6, 2017

In this previous , my colleague discussed the benefits of using the Page Object Model Pattern to write your automated tests. In this video blog, I’ll show you some examples of how to write POM tests using the latest release of (3.0).

Additional Thoughts

Because Selenified supports parallel test execution, it’s important to ensure tests have the resources required to execute concurrently. For this reason, my example creates a Thread Safe instance of our Google page object.

ThreadLocal google = new ThreadLocal<>();

By instantiating a ThreadLocal object in combination with the setupApp() method, we ensure that multiple tests can reuse the same elements as each thread creates its own local instance of the class variables.

Also, at 9:59 when describing my Google search box element, I stated that I created an “App” Object when it should have been an “Element” Object.

 

Coveros Staff

Coveros Staff

This post represents the collective insights of the Coveros team. Our staff consists of software experts who bring deep experience in secure agile development, DevOps, testing, and software quality. Over the past 20 years, Coveros has trained more than 30,000 professionals and worked with half of the Fortune 100 companies on mission-critical software development challenges. We draw on this extensive experience to share practical insights, proven strategies, and real-world solutions that help organizations build better software faster and more securely.