SINGLE PAGE SCRIPTS

From Test Automation Patterns
Revision as of 10:56, 29 April 2018 by Seretta (talk | contribs) (Topic titles in capital letters)
Jump to navigation Jump to search
.................................................................................................................Main Page / Back to Design Patterns / Back to Test Automation Patterns

Pattern summary

Develop an automation script for each window or page.
In the Selenium Community, this Pattern is known as "PAGE OBJECT".

Category

Design

Context

Use this pattern to build efficient, modular and maintainable testware.
It's not necessary for disposable scripts.

Description

In order to build modular scripts it is convenient to develop one for each window or page that will be driven by the tests.
A "page object" is a test object that holds the details of all the elements on a web page that might be involved in an automated test.

Implementation

If you use KEYWORD-DRIVEN TESTING you can implement this pattern by introducing a keyword for every window in your application. The keyword parameters will drive the GUI-Elements in the window.

For HTML-Pages map a UI page to a class, where for example a page is your HTML page. The functionality to interact or make assertions about that that page is captured within the Page class. Then these methods may be called by a test.

Potential problems

This can become complex if it is not done well. The main benefit is increased maintainability of tests, so it is best used to reduce repetition of the same test code on multiple pages.

Issues addressed by this pattern

GIANT SCRIPTS
OBSCURE TESTS

Experiences

If you have used this pattern, please add your name and a brief story of how you used this pattern: your context, what you did, and how well it worked - or how it didn't work!

Here are some blogs with discussion about the Page Object pattern:

http://blog.josephwilk.net/cucumber/page-object-pattern.html,

http://www.shino.de/2011/07/26/on-the-pageobject-pattern/


.................................................................................................................Main Page / Back to Design Patterns / Back to Test Automation Patterns