SKIP VOID INPUTS
Arrange for an easy way to automatically skip void inputs
Use this pattern to write efficient reusable scripts. It's not necessary for disposable scripts.
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
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
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.
Data for the Component "Customer Details"
||6015 Dove, San Diego
||Ringvej 5, 3450 Lynge
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
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>
Then if the corresponding statements in the DATA were:
The framework would execute statements 1, 2 and 4 from the DRIVER, but ignore statements 3 and 5
If you have also used this pattern and would like to contribute your experience to the wiki, please go to Feedback to submit your experience or comment.