Difference between revisions of "SINGLE PAGE SCRIPTS"

From Test Automation Patterns
Jump to navigation Jump to search
m (Topic titles in capital letters)
Line 15: Line 15:
 
''<span style="font-size: 16px">[[GIANT SCRIPTS]]</span>''<br /> ''<span style="font-size: 16px">[[OBSCURE TESTS]]</span>''
 
''<span style="font-size: 16px">[[GIANT SCRIPTS]]</span>''<br /> ''<span style="font-size: 16px">[[OBSCURE TESTS]]</span>''
 
=<span style="font-size: 16px">'''Experiences'''</span>=
 
=<span style="font-size: 16px">'''Experiences'''</span>=
<span style="font-size: 16px">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!</span><br /> <br /> <span style="font-size: 16px">Here are some blogs with discussion about the Page Object pattern:</span><br /> <br /> <span style="font-size: 16px">http://blog.josephwilk.net/cucumber/page-object-pattern.html,</span><br /> <br /> <span style="font-size: 16px">http://www.shino.de/2011/07/26/on-the-pageobject-pattern/</span><br /> <br /> <br /> <span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Patterns]] / Back to [[Test Automation Patterns]]</span></div>
+
 
 +
<span style="font-size: 16px">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!</span><br /> <br />  
 +
 
 +
<span style="font-size: 16px">Here are some blogs with discussion about the Page Object pattern:</span><br /> <br /> <span style="font-size: 16px">http://blog.josephwilk.net/cucumber/page-object-pattern.html,</span><br /> <br /> <span style="font-size: 16px">http://www.shino.de/2011/07/26/on-the-pageobject-pattern/</span><br /> <br /> <br />  
 +
 
 +
<span style="font-size: 16px">If you have used this pattern and would like to contribute your experience to the wiki, please go to [[Experiences]] to submit your experience or comment.</span><br /> <br />
 +
 
 +
 
 +
<span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Patterns]] / Back to [[Test Automation Patterns]]</span></div>

Revision as of 08:42, 5 July 2018

.................................................................................................................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/


If you have used this pattern and would like to contribute your experience to the wiki, please go to Experiences to submit your experience or comment.


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