In this post, we are going to demonstrate, how you may use your data stored in excel files to perform data driven testing with the help of looping feature of vREST.
Here is the video tutorial for the same:
<iframe width="560" height="315" src="https://www.youtube.com/embed/_NuKk02t5XE?list=PLmua155_WrDyoe7dYDB3lCfh-UK4XicT6?ecver=1" frameborder="0" allowfullscreen></iframe> |
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 with the help of Mock server.
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. |
Steps:
First fetch data with the help of a REST API
We are using Mock server to fetch data for our Update Contact API. You can extract test case data from any third party application with the help of a REST API.
We have defined the mock server response in the following format:
Now in Test Case's tab, fetch data using a separate test case as shown in snapshot below:
Now extract the whole response with the help of special path "$". In the below snapshot, we have extracted the whole response in a variable named "data". We will use this variable as loop source.