Skip to content

Executing Data Driven Testing using UDV for Test Case 1

This article is a part of the Self-paced Learning Series for the Course: First-Hand Experience of Worksoft SaaS.

Please refer to the link for more details on the Course.
 
 Mapping the Worksoft SaaS feature to the Course Context :: Lesson 6 :: Topic 1 (Part 1)


1. Data-Driven Testing using User-Defined Variables (UDV)
In the previous module, the values of Test Case 1 were hardcoded to the Test Scripts.

In this step, let's use the same values of Test Case 1 and update them in the User Defined Variables, to see how the test logic can be separated from test data and also see benefits of using UDV's.

As we have learnt about UDV's by reading the feature article, we will proceed to create the UDV in Worksoft SaaS.

We will create 6 UDV's (name-value pairs):
Name Value
Age 45
Annual_Income $20,000
Zip_Code  08817
Annual_Premium $1,021
Annual_Penalty $200
Calculator_Result_Header   You are eligible for a subsidy.  
After the UDV's are created, we want Worksoft SaaS to read values from UDV's instead of the hardcoded values in the Test Scripts, when the Test is executed.

Hence, we will delete the hardcoded values in the Test Scripts and bind them to the UDV's and then run the test execution.
    
2. Practice: Create UDV
Now that we know what is UDV, let's learn how to create UDV in Worksoft SaaS. We will create 6 UDV's (name-value pairs):
  1. Click Menu and Click User-Defined Variables.
  2. There are UDV's available at 2 levels: Project Level and Product Level (mouse over on the icon to see the Level). Expand the Product 'Health Insurance Cost Calculator'. For creating the first UDV, you will see 'No UDV's created, Click here to Create a UDV'
  3. The UDV Type is 'Manual' by default. Enter the name of UDV as 'Age'. Encrypt values are set to 'No' by default. Save UDV.
  4. To enter the value of Age, click on the edit icon of the User-Defined Variable action column, and in the Production environment column, enter the value as '45'. Save the UDV.
  5. To create more UDV's, click on the edit icon of the existing User-Defined Variable and click 'Create New User-Defined Variable' and Enter UDV as Annual_Income and Save it.
  6. In the action click on the edit icon and click on enter/edit value of Annual_Income and enter the value as 20000
  7. Click on the edit icon and click on 'Create New User-Defined Variable' and Enter UDV as Annual_Premium and Save it.
  8. In the action click on the edit icon and click on enter/edit value of Annual_Premium and enter the value as $1,021.
  9. Click on the edit icon and click on 'Create New User-Defined Variable' and Enter UDV as Annual_Penalty and Save it.
  10. In the action click on the edit icon and click on enter/edit value of Annual_Penalty and enter the value as $200
  11. Click on the edit icon and click on 'Create New User-Defined Variable' and Enter UDV as Zip_Code and Save it.
  12. In the action click on the edit icon and click on enter/edit value of Zip_Code and enter the value as 08817.
  13. Click on the edit icon and click on 'Create New User-Defined Variable' and Enter UDV as Calculator_Result_Header and Save it.
  14. In the action click on the edit icon and click on enter/edit value of Calculator_Result_Header and enter the value as 'You are eligible for a subsidy'. 
3. Practice: Executing Tests with UDV
Recommendation: In case you are unable to find the Bind to UDV icon, please refer to the Video
  1. Clone the test script 'Enter & Submit Inputs for HICC - State = NJ Zip = 08817 Age = 45 Income = $20000' and change the Test Script name to 'Enter & Submit Inputs for HICC (Parameterized with UDVs
  2. Expand each Instruction and bind it to User_Defined_Variable as below:  
  3. Double-click the age instruction, remove the value 45, click on the UDV icon. In the dropdown, click the arrow button to expand the UDV and find the User Defined Variables created for the Product - Health Insurance Calculator. Then select 'Age' which will be updated in the Value field.
  4. Double-click the income instruction, remove the value $20000, Click on the UDV button to update the Income Variable in the Value field   
  5. Double-click the Zip-code Instruction, remove the value 08817, Click on the UDV button to update the Zipcode Variable in the Value field  
  6. Scroll to the top of the page and click 'Save as WIP and Exit'
  7. Next, clone Verify Results of the HICC - State = NJ Zip = 08817 Age = 45 Income = $20000' and make the following changes:      
  8. Update the Test Script name to Verify Results of the HICC (Parameterized with UDVs)  
  9. Remove the existing values of the below-mentioned attributes: 
  10. Result Header and bind it to User_Defined_Variable # Calculator_Result_Header 
  11. Premium and bind it to User_Defined_Variable # Annual_Premium 
  12. Penalty and bind it to User_Defined_Variable # Annual_Penalty.
  13. Save the test script
  14. Now, Clone the Scenario 'Perform data inputs and verify results for HICC - State = NJ Zip = 08817 Age = 45 Income = $20000' and make changes to the Name and Test Scripts     
  15. Update the Scenario name to 'Perform data inputs and verify results for HICC (Data-driven by UDVs)' 
  16. Delete the existing Test Scripts             
  17. Assemble the Test Scripts: Enter & Submit Inputs for HICC (Parameterized with UDVs) & Verify Results of the HICC (Parameterized with UDVs)                        
  18. Save as WIP and Exit
  19. Lastly, Clone the RD and make changes to the Name and Scenarios:   
  20. Update the RD name to 'Verify HICC calculations (Data-driven by UDVs)'  
  21. Delete the existing Scenario
  22. Assemble the new Scenario 'Perform data inputs and verify results for HICC (Data-driven by UDVs)' with Predeccesor Scenario.     
  23. Proceed to Testing Context and Select the Production environment.
  24. Execute the new Run Definition.

Please note: 
  • It is not mandatory to clone all the entities to execute Data-driven Tests using UDV, however, in order to maintain a clear Learning history for the purpose of this training, we recommend that you follow this best practice of cloning all the entities as mentioned in the steps above. 
  • This will be very helpful when you want to refer to these steps in your Sandbox, at the time of performing Certification exercises.


    

Feedback and Knowledge Base