Automation Test Practice

Follow me on GitHub

Page Object Model and Fluent Design II

In previous section, I introduced how to design page object. That is only half of the story actually.

Designing an automation test framework is similar to designing any other software framework or product, we need follow the typical software engineering best practice like code standard, code review, and of course Unit Test. Yeah, we need to write unit test for our automation test code.

Unit Test

As each page object will be widely used by various test case, we need to make sure our page object is functional at first. Thus for each page objct, we need to write a corresponding Page Object Test class to test the logic in that page object. Typically this class is named with [PageObjectName]Test.

Of course, for all other helper classes, util classes we designed in the framework, we need corresponding unit test.

Fluent Design

Fluent design pattern is to write functional test in the DSL style, which is intuitive and easy readable for programmers who use the page objects. See following as example:

fluent.png

That is why for a specific method, if it navigates to a new page, it should return that new page object; if it stays on current page, return current page object.

Fluent design will also be widely used in web service automation test.

Back To Homepage
Page Object Model and Fluent Design I