Using Test Data in Test Cases
DevAssure streamlines the process of incorporating test data into your test cases. By binding relevant test data, you ensure your tests are executed with the necessary information and values.
DevAssure automatically binds test data to test cases, depending on the chosen test data for the testcase.
For Table/ CSV/ Advanced Test Data :
-
Once you select the desired test data format (Table, CSV, or Advanced), DevAssure automatically populates the corresponding testcase with the data's column values.
-
These populated values are prefixed with "testData." followed by the specific column name.
-
For example, if the test data has a column named "Username," the bound value would appear as "testData.Username".
Example:
Consider a test case that validates user login functionality.
You might have a "Username" and "Password" stored in table format. After binding the test data, the test case steps will be as below.
Input value testData.Username in web > DevAssure > userEmail
Input value testData.Password inweb > Login > Password
For Database :
- On selecting Database and the saved Database query in test data section, user can invoke the query in test cases and perform the desired operation using the respective query test actions.
- Within the test case steps, the chosen query can be invoked using Invoke database query test action. This action retrieves data based on the query and stores the response.
- The stored response can be used to perform various assertions in the test case steps.
These assertions can involve:
-
Verifying the number of returned rows.
-
Checking if specific values within the response match expected values from the test data (e.g., verifying the "user_id" from the response matches a constant named "Name").
Example:
databaseResponse = Invoke database query CartQuery.
Verify row count from query response databaseResponse > 5
Verify database query response databaseResponse 1 testData.user_id equals constants.constant1.Name
For Group Test Data** :
-
When using Group, the populated values have a double prefix.
- The first prefix is "testData." followed by the data label associated with the test data in the group.
- The second prefix is the specific column name of the data label in the group.
-
Data labels help differentiate between various sets of test data within the group. This ensures using the correct data in test case.
-
Example:
Imagine a Test Data Group named "addToCart" containing test data with datalabels "user" and "qtydisc".
Binding this group would populate values like "testData.user.city" and "testData.qtydisc.discount".
user : user.user|user.city
qtydisc : qtydisc.quantity|qtydisc.discount
Troubleshooting
If you encounter issues during Data-Driven Testing, reach out to our support team for assistance. Receiving Support