Binding "Attributes" from the Data Definition to Targets and/or Values for "Instructions" within your Test Script
To begin parameterizing the “Instructions” within your Test Script, click the ‘Edit’ icon for the Instruction you intend to parameterize. A popover that shows the Instruction in edit mode opens up.
On the popover (Edit) window, you will see the Command, Target, and Value fields along with the User Notes for the Instruction.
In the Target section and the Value section, the drop-down that has a ∞A graphical icon at the end. When you expand, shows you the list of ‘Attributes’ from the Data Definition you have chosen as the basis for the parameterization of your Test Script. The drop-down that has a ∞F graphical icon at the end is used for ‘Binding to Files’, a topic that is not covered here. But please note that Binding of Instructions (actually this is allowed for ‘Values’ only and NOT for ‘Targets’) to “Files” is not used in the context of Data-driven testing.
You can parameterize your Target or Value or both. To do this, just choose the appropriate Attribute from the drop-down corresponding to either or both Target and Value fields. As mentioned previously, calling this ‘Binding to Attributes’ for short.
Once you are done with “Binding to Attributes”, you click on ‘Save’ button (and this closes the popover).
You can then repeat the same steps to parameterize all other Instructions in that Test Script that you needed to parameterize. Once you have parameterized all the Instructions, the screen would be shown like below:
Please note that in the screenshot above, the 4th Instruction, which corresponds (in the context of the Health Care Calculator Input Form) to the field that is used to signify to the calculator if the Applicant (the Individual seeking Insurance under the Obama Care Law) currently has insurance coverage from his/her employer. This field is intentionally not bound to any Attribute of the Data Definition for 2 reasons:
- We just wanted to illustrate to you through a real-life example that not all Instructions need to be bound to Data Definition Attributes for you to be able to Parameterize your Scripts
- The test coverage we are looking to cover for this AUT only includes testing the calculator when employers don’t offer insurance, and hence the Test Script was developed in QaSCRIBE to hard code it to a ‘No’.
Once you have bound all Instructions to the Attributes from your Data Definition based on the intended Test Coverage of your Data-Driven Test, please ‘Save’ the Test Script.
Worksoft SaaS shows your Test Script as now Parameterized (Bound to Attributes) in the Scripts Grid:
You should now complete the Parameterization for the other Test Scripts as well that you need to prepare for Data-driven test execution.
A few critical points worth noting here:
- Just because you started parameterization of a Test Script does NOT mean that you must bind an Attribute to every Instruction in that Script. You can have only a subset of your Instructions parameterized. The Test Script “HI_Open_Web_Page” was NOT linked to any Data Definition because it is a Test Script that opens the Health Insurance Calculator website and don’t need this happening as part of the data-driven loops/iterations.
- You have to decide which scripts need to loop/iterate for your test executions (Scenario Validations and Run Definition executions) in a data-driven mode. In the context of the Health Insurance Premium & Penalty Calculator, you want the “HI_Enter_Details” and “HI_Verify_Calculated_Insurance” to iterate through all the rows in your Data File. You hence would decide to link those Test Scripts to the Data Definition “Premium & Penalty Calculator - Expected Output by Test Input”.
- In some circumstances, you may have to just choose to link a “Data Definition” to the Test Script but are NOT required to bind any of the instructions to Attributes from that Data Definition. This is required to just tell Worksoft SaaS which Scripts within a Scenario you want to be looped or iterated through when the Scenario runs in a Data-Driven mode. This is the 'cue' to Worksoft SaaS to automatically detect and apply an 'Implicit Data Loop' as described in the article titled "Two Approaches for Data Looping - Implicit vs. Explicit". More on this later in the document.
o The Test Script “HI_Calculated_Insurance” was linked to the Data Definition “IPC" even though none of the Instructions in that Test Script were parameterized (because none needed to be parameterized).
- You can bind the same Attribute to Targets and/or Values for more than one Attribute of the same Test Script, if your business logic requires you to.
- If you made a mistake in binding the Attributes to (Targets and Values of) Instructions, you can always ‘Edit’ your Instructions, and change the Bindings.
- If your mistake was binding an Attribute to an
Instruction when you did not need to, you can just undo the Binding by going
back to the Edit mode, and choosing ‘Select an 'Attribute' from the bound data definition:
- ’ from the Attribute drop-down (as if no Attribute is specifically selected) and save the Test Script.