Data Driven Test
Often there might be may be a number of data sets that have to be used to test a feature of in your application. Now running the same test with different data manually is time-consuming
Data-driven allows testing your application with different inputs and validation values used within a test case to quickly and easily ensure that your application performs as expected with a range of data.
CloudQA provides user to test data in two different approaches
3. Data Driven at TestSuite Level
4. Data Driven at Environment Level
1. Using CSV file
CloudQA has a built-in option for data-driven testing that allows you to upload a CSV spreadsheet file using
a. Variable approach: When you want to run different sets of data for only selected input fields in your test case, variable approach is used.
b. Input Fields approach: If you want to test entire test case with data sets, input Fields can be used.
a. Variable approach:
For example, if a user wants to test email ID field and last name field with different sets of user-defined data in a test case, then variable approach can be used.
Below is the procedure create and execute data driven test using variables
Navigate to edit steps of test case and select the input field(s)
Name the input fields
__variable name__
(double-undersore variable name double-undersore) as shown below
Click on Custom Execute of a test case in actions column
Select the checkbox "Use a CSV file for Data Driven testing"
Select As variables radio button
Upload the CSV file with header as
variable name
given in the test case and followed by rows of data.Click on execute
b. Input Fields approach:
If you want to test entire test case, for example "create customer" test case, all the input fields has to be tested with different data sets, Input fields can be used.
Below is the procedure create and execute data driven test using input field
Click on Custom Execute of a test case in actions column
Select the checkbox "Use a CSV file for Data Driven testing"
Select As input fields radio button
Download file template, provide data and save the file on disk.
Choose the file with data
Execute the Data Driven Test
2. Using Random variable
You can reuse a test case with different values by using Random Variables.
Use case
A test case with the creation of a user always requires new sets of data, to re-execute the test case. Instead of changing values every time in edit test case or changing in the application, you can use random variables.
How does it work?
- Go to Edit Steps of a test case, Navigate to the step type in the test case
- Clear the value and type "__"(Double underscore) and auto suggest will show up all random options
- Pick the random option based on requirement and save the test case
3. Data Driven Test at Testsuite Level
Use case If you want to test the entire test suite or all the test cases in a suite with different data sets, you don't have to switch on toggle for each test case in the test suite, instead you can upload the csv file at test suite level.
How does it work?
Navigate to the edit steps of test case(s) and select the input field(s)
Name the input fields
__variable name__
(double-undersore variable name double-undersore) as shown below
Navigate to Test Suites tab
As a prerequisite create a test suite, click on play button in the actions column, select the check box Use a CSV file for Data Driven testing
Upload the CSV file with header as
variable name
given in the test case(s) and followed by rows of data.Click on execute
4. Data Driven Test at Environment Level
Use case If the application has multiple environemts and each environment needs a separate Data Driven File, then this approach can be used.
How does it work?
a. Setting up Test Variables
To get started, you’ll want to swap one or more variables into your test case(s) step values, for instance username ((double-undersore variable name double-undersore)) have been swapped into the test case below.
These variables will correspond with the headers in our CSV file.
Navigate to Settings[https://app.cloudqa.io/User/AppSettings] of a application and Environments where the environments are listed
Click on Edit, and Upload the CSV File with header as variable name given in the test case(s) and followed by rows of data.
Upload the CSV File and Save
b. Execute the Test case and Test suite DDT file at Environment level
Test Case
Navigate to Test Case page, Click on Custom Execute of a test case in actions column, Choose the Environment/Base URL
Select the checkbox "Use a CSV file for Data Driven testing"
If the file is uploaded at Environment Level, there will be option to choose Environment Variables File
Select Environment Variables File radio button and execute the test case
The test case will execute as per the data uploaded in CSV File
TestSuite
Navigate to Test Suites tab
As a prerequisite create a test suite, click on play button in the actions column, select the Base URL, check box Use a CSV file for Data Driven testing and select Environment Variables File radio button and execute the Suite
NOTE:
It will execute the first test case with the number of rows entered and then executes the next test case
Only maximum 20 rows of data can be used