In this post, we are going to demonstrate, how you may perform data driven testing with the help of looping feature of vREST. We will provide the sample files needed to quickly start data driven testing.
Context: We are defining test cases for a sample Contacts Application. More specifically we are validating various scenarios of Update Contact API with the help of loop. And we are providing data to Update Contact API from a CSV file using vutil module.
For providing data with the help of CSV file, you will need to install vutil module. vutil module converts this CSV file into JSON format via REST API. For more information, please read Fetch CSV data for data driven testing.
- Download the sample CSV file and sample test cases file
Download Data Driven Test Cases File
Sample CSV File
- Import the Sample test cases file in your vREST instance
You can import the test case file by following the steps below:
- In Test Cases tab toolbar, Go to "More Dropdown" >> "Import Test Cases"
- You will get the following modal window. Please fill the form as shown below to import the sample test cases.
Note: If you are using Trial version of vREST then you will not be able to import the sample test case file via importer. Please contact us by sending an email to us. We will enable the Import functionality in your trial version.
- Configure the global variables to be used in sample test cases
You will need to configure the following global variables:
- dataDir: Please provide the directory path of sample CSV file here.
- vutilBaseURL: Default base URL for vutil module is provided. If you are running vutil module on a different port then you will need to change this base URL.
Note: Please make sure that vutil server is running on your system. For more information on vutil module, please read this guide link.
- That's it. You may now run the imported sample test cases.