Difference between revisions of "SINGLE PAGE SCRIPTS"

From Test Automation Patterns
Jump to navigation Jump to search
(Created page with "<div id="content_view" class="wiki" style="display: block"><span style="font-size: 14px">.........................................................................................")
 
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<div id="content_view" class="wiki" style="display: block"><span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Patterns]] / Back to [[Test Automation Patterns]]</span>
 
<div id="content_view" class="wiki" style="display: block"><span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Design Patterns]] / Back to [[Test Automation Patterns]]</span>
=<span style="font-size: 16px">Pattern summary</span>=
+
=<span style="font-size: 16px">'''Pattern summary'''</span>=
 
<span style="font-size: 16px">Develop an automation script for each window or page. </span><br /> <span style="font-size: 16px">In the Selenium Community, this Pattern is known as "PAGE OBJECT".</span>
 
<span style="font-size: 16px">Develop an automation script for each window or page. </span><br /> <span style="font-size: 16px">In the Selenium Community, this Pattern is known as "PAGE OBJECT".</span>
=<span style="font-size: 16px">Category</span>=
+
=<span style="font-size: 16px">'''Category'''</span>=
 
<span style="font-size: 16px">Design</span>
 
<span style="font-size: 16px">Design</span>
=<span style="font-size: 16px">Context</span>=
+
=<span style="font-size: 16px">'''Context'''</span>=
 
<span style="font-size: 16px">Use this pattern to build efficient, modular and maintainable testware.</span><br /> <span style="font-size: 16px">It's not necessary for disposable scripts.</span>
 
<span style="font-size: 16px">Use this pattern to build efficient, modular and maintainable testware.</span><br /> <span style="font-size: 16px">It's not necessary for disposable scripts.</span>
=<span style="font-size: 16px">Description</span>=
+
=<span style="font-size: 16px">'''Description'''</span>=
 
<span style="font-size: 16px">In order to build modular scripts it is convenient to develop one for each window or page that will be driven by the tests. </span><br /> <span style="background-color: #ffffff; color: #252525; font-size: 16px">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.</span>
 
<span style="font-size: 16px">In order to build modular scripts it is convenient to develop one for each window or page that will be driven by the tests. </span><br /> <span style="background-color: #ffffff; color: #252525; font-size: 16px">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.</span>
=<span style="font-size: 16px">Implementation</span>=  
+
=<span style="font-size: 16px">'''Implementation'''</span>=  
 
<span style="font-size: 16px">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.</span><br /> <br /> <span style="font-size: 16px">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.</span>
 
<span style="font-size: 16px">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.</span><br /> <br /> <span style="font-size: 16px">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.</span>
=<span style="font-size: 16px">Potential problems</span>=
+
=<span style="font-size: 16px">'''Potential problems'''</span>=
 
<span style="font-size: 16px">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.</span><br /> <br />  
 
<span style="font-size: 16px">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.</span><br /> <br />  
=<span style="font-size: 16px">Issues addressed by this pattern</span>=
+
=<span style="font-size: 16px">'''Issues addressed by this pattern'''</span>=
 
''<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">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 [[Feedback]] 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>

Latest revision as of 15:58, 21 August 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

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 Feedback to submit your experience or comment.


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