SKIP VOID INPUTS

From Test Automation Patterns
Revision as of 16:05, 21 August 2018 by Dorothy (talk | contribs) (→‎Experiences)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
.................................................................................................................Main Page / Back to Execution Patterns / Back to Test Automation Patterns

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

INEFFICIENT EXECUTION

Experiences

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


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.

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