Difference between revisions of "SKIP VOID INPUTS"
(Created page with "<div id="content_view" class="wiki" style="display: block"><span style="font-size: 14px">.........................................................................................") |
m (Topic titles in capital letters) |
||
Line 1: | Line 1: | ||
<div id="content_view" class="wiki" style="display: block"><span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Execution 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 [[Execution 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">Arrange for an easy way to automatically skip void inputs</span> | <span style="font-size: 16px">Arrange for an easy way to automatically skip void inputs</span> | ||
− | =<span style="font-size: 16px">Category</span>= | + | =<span style="font-size: 16px">'''Category'''</span>= |
<span style="font-size: 16px">Execution</span> | <span style="font-size: 16px">Execution</span> | ||
− | =<span style="font-size: 16px">Context</span>= | + | =<span style="font-size: 16px">'''Context'''</span>= |
<span style="font-size: 16px">Use this pattern to write efficient reusable scripts. It's not necessary for disposable scripts.</span> | <span style="font-size: 16px">Use this pattern to write efficient reusable scripts. 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">The more standardized your scripts the easier it will be to maintain them. To be able to use the same scripts even when not all data fields will be given, you should foresee some way to automatically skip void inputs</span> | <span style="font-size: 16px">The more standardized your scripts the easier it will be to maintain them. To be able to use the same scripts even when not all data fields will be given, you should foresee some way to automatically skip void inputs</span> | ||
− | =<span style="font-size: 16px">Implementation</span>= | + | =<span style="font-size: 16px">'''Implementation'''</span>= |
− | span style="font-size: 16px">Use a [[TEST AUTOMATION FRAMEWORK]] that supports skipping void inputs. See the examples below for some suggestions how to realize this</span> | + | <span style="font-size: 16px">Use a [[TEST AUTOMATION FRAMEWORK]] that supports skipping void inputs. See the examples below for some suggestions how to realize this</span> |
− | =<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">[[INEFFICIENT EXECUTION]]</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 | + | <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 /> <span style="font-size: 16px">Example 1</span><br /> |
− | |||
<span style="font-size: 16px">''Ane Clausen'' describes how she implemented the pattern in QTP using QC Components:</span><br /> <span style="font-size: 16px">To be able to combine data regardless if data is available (empty) or not we coded “skip-“ functions in QTP. These functions are used in QC Components.</span><br /> <br /> <span style="font-size: 16px">Example: </span><br /> <br /> <span style="font-size: 16px">Data for the Component "Customer Details"</span><br /> | <span style="font-size: 16px">''Ane Clausen'' describes how she implemented the pattern in QTP using QC Components:</span><br /> <span style="font-size: 16px">To be able to combine data regardless if data is available (empty) or not we coded “skip-“ functions in QTP. These functions are used in QC Components.</span><br /> <br /> <span style="font-size: 16px">Example: </span><br /> <br /> <span style="font-size: 16px">Data for the Component "Customer Details"</span><br /> | ||
{| class="wiki_table" | {| class="wiki_table" | ||
Line 37: | Line 36: | ||
<br /> <span style="font-size: 16px"> If there is no data for a column you just write “SKIP” in the data sheet and therefore the column is skipped.</span><br /> <span style="font-size: 16px">By having you write "SKIP" and not just leave the column blank, the system forces you to consider if the data is available or not, and documents that you have actually considered the issue.</span><br /> <br /> <span style="font-size: 16px">The Skip function “SetSkip” is coded in QTP like this:</span><br /> <br /> | <br /> <span style="font-size: 16px"> If there is no data for a column you just write “SKIP” in the data sheet and therefore the column is skipped.</span><br /> <span style="font-size: 16px">By having you write "SKIP" and not just leave the column blank, the system forces you to consider if the data is available or not, and documents that you have actually considered the issue.</span><br /> <br /> <span style="font-size: 16px">The Skip function “SetSkip” is coded in QTP like this:</span><br /> <br /> | ||
<span style="font-size: 16px">'‘Sets the value for the selected object or jumps over the field</span><br /> <span style="font-size: 16px"> Public Function SetSkip(test_object, Content</span><br /> <span style="font-size: 16px"> If Trim(UCase(Content)) <> "SKIP" Then</span><br /> <span style="font-size: 16px"> test_object.set Content</span><br /> <span style="font-size: 16px"> End If</span><br /> <span style="font-size: 16px"> End Function</span><br /> <br /> | <span style="font-size: 16px">'‘Sets the value for the selected object or jumps over the field</span><br /> <span style="font-size: 16px"> Public Function SetSkip(test_object, Content</span><br /> <span style="font-size: 16px"> If Trim(UCase(Content)) <> "SKIP" Then</span><br /> <span style="font-size: 16px"> test_object.set Content</span><br /> <span style="font-size: 16px"> End If</span><br /> <span style="font-size: 16px"> End Function</span><br /> <br /> | ||
− | <span style="font-size: 16px"> RegisterUserFunc "WebEdit", "SetSkip", "SetSkip", True</span><br /> <span style="font-size: 16px">RegisterUserFunc "WebCheckBox" , "SetSkip", "SetSkip", True </span><br /> <span style="font-size: 16px"> RegisterUserFunc "WebFile" ,"SetSkip", "SetSkip", True</span><br /> <span style="font-size: 16px">You can also code “skip” functions for other objects such as:</span><br /> <br /> <span style="font-size: 16px"> • Public Function SelectSkip(test_object, Content)</span><br /> <span style="font-size: 16px">• Public Function ClickSkip(test_object, Content)</span><br /> <span style="font-size: 16px">• Public Function VerifyPropertySkip(test_object, Content)</span> | + | <span style="font-size: 16px"> RegisterUserFunc "WebEdit", "SetSkip", "SetSkip", True</span><br /> <span style="font-size: 16px">RegisterUserFunc "WebCheckBox" , "SetSkip", "SetSkip", True </span><br /> <span style="font-size: 16px"> RegisterUserFunc "WebFile" ,"SetSkip", "SetSkip", True</span><br /> <span style="font-size: 16px">You can also code “skip” functions for other objects such as:</span><br /> <br /> <span style="font-size: 16px"> • Public Function SelectSkip(test_object, Content)</span><br /> <span style="font-size: 16px">• Public Function ClickSkip(test_object, Content)</span><br /> <span style="font-size: 16px">• Public Function VerifyPropertySkip(test_object, Content)</span><br /><br /> <span style="font-size: 16px">Example 2</span> |
− | |||
<span style="font-size: 16px">''Seretta'':</span><br /> <br /> | <span style="font-size: 16px">''Seretta'':</span><br /> <br /> | ||
− | + | <span style="font-size: 16px">Since in my company we are using Command-Driven Testing (a type of [[KEYWORD-DRIVEN TESTING]]), we have implemented this pattern in a slightly different way.</span><br /> <span style="font-size: 16px">We split our data files in a navigation part (DRIVER) where all data is substituted with place holders (DATA-Codes) and a data part (DATA) where the place holders point to the real data. When we don’t have a value for a particular DATA-Code the framework just skips the whole statement. This enables us to write comprehensive DRIVERs that can be used both for simple and quite complicated test cases.</span><br /> <br /> <span style="font-size: 16px">For example suppose that in our DRIVER we would find the following statements:</span><br /> | |
− | + | <span style="font-size: 16px">1 INPUT, FirstName,<FirstName></span><br /><span style="font-size: 16px">2 INPUT, LastName,<LastName></span><br /><span style="font-size: 16px">3 INPUT, Address,<Address> </span><br /><span style="font-size: 16px">4 SELECT,Button, <OK></span><br /><span style="font-size: 16px"> 5 SELECT,Button,<Cancel></span><br /><br /> | |
− | |||
<span style="font-size: 16px">Then if the corresponding statements in the DATA were:</span><br /> | <span style="font-size: 16px">Then if the corresponding statements in the DATA were:</span><br /> | ||
− | + | <span style="font-size: 16px"><FirstName>,Jane</span><br /> <span style="font-size: 16px"><LastName>,Doe</span><br /> <span style="font-size: 16px"><OK>,btnOK</span><br /> | |
<span style="font-size: 16px">The framework would execute statements 1, 2 and 4 from the DRIVER, but ignore statements 3 and 5</span><br /> | <span style="font-size: 16px">The framework would execute statements 1, 2 and 4 from the DRIVER, but ignore statements 3 and 5</span><br /> | ||
− | |||
<span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Execution Patterns]] / Back to [[Test Automation Patterns]]</span></div> | <span style="font-size: 14px">.................................................................................................................[[Main Page]] / Back to [[Execution Patterns]] / Back to [[Test Automation Patterns]]</span></div> |
Revision as of 14:09, 1 May 2018
Pattern summary
Arrange for an easy way to automatically skip void inputs
Category
Execution
Context
Use this pattern to write efficient reusable scripts. It's not necessary for disposable scripts.
Description
The more standardized your scripts the easier it will be to maintain them. To be able to use the same scripts even when not all data fields will be given, you should foresee some way to automatically skip void inputs
Implementation
Use a TEST AUTOMATION FRAMEWORK that supports skipping void inputs. See the examples below for some suggestions how to realize this
Issues addressed by this pattern
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!
Example 1
Ane Clausen describes how she implemented the pattern in QTP using QC Components:
To be able to combine data regardless if data is available (empty) or not we coded “skip-“ functions in QTP. These functions are used in QC Components.
Example:
Data for the Component "Customer Details"
Customer Name |
Customer Address |
Country |
Telephone |
Email |
Chris Schmith |
6015 Dove, San Diego |
USA |
004412345678 |
SKIP |
Mary Larsen |
Ringvej 5, 3450 Lynge |
DK |
SKIP |
SKIP |
If there is no data for a column you just write “SKIP” in the data sheet and therefore the column is skipped.
By having you write "SKIP" and not just leave the column blank, the system forces you to consider if the data is available or not, and documents that you have actually considered the issue.
The Skip function “SetSkip” is coded in QTP like this:
'‘Sets the value for the selected object or jumps over the field
Public Function SetSkip(test_object, Content
If Trim(UCase(Content)) <> "SKIP" Then
test_object.set Content
End If
End Function
RegisterUserFunc "WebEdit", "SetSkip", "SetSkip", True
RegisterUserFunc "WebCheckBox" , "SetSkip", "SetSkip", True
RegisterUserFunc "WebFile" ,"SetSkip", "SetSkip", True
You can also code “skip” functions for other objects such as:
• Public Function SelectSkip(test_object, Content)
• Public Function ClickSkip(test_object, Content)
• Public Function VerifyPropertySkip(test_object, Content)
Example 2
Seretta:
Since in my company we are using Command-Driven Testing (a type of KEYWORD-DRIVEN TESTING), we have implemented this pattern in a slightly different way.
We split our data files in a navigation part (DRIVER) where all data is substituted with place holders (DATA-Codes) and a data part (DATA) where the place holders point to the real data. When we don’t have a value for a particular DATA-Code the framework just skips the whole statement. This enables us to write comprehensive DRIVERs that can be used both for simple and quite complicated test cases.
For example suppose that in our DRIVER we would find the following statements:
1 INPUT, FirstName,<FirstName>
2 INPUT, LastName,<LastName>
3 INPUT, Address,<Address>
4 SELECT,Button, <OK>
5 SELECT,Button,<Cancel>
Then if the corresponding statements in the DATA were:
<FirstName>,Jane
<LastName>,Doe
<OK>,btnOK
The framework would execute statements 1, 2 and 4 from the DRIVER, but ignore statements 3 and 5