Ask a Question

Data Driven tests from an excel file

armygrad
Contributor

Data Driven tests from an excel file

Hi

 

I have created a excel file with a single column and 10 rows of data, how do i get the record from the excel file, to a specific part of

my POST call, called VRN.

 

Thanks

4 REPLIES 4
armygrad
Contributor

how do i get the loop to work?

ChrisAdams
Champion Level 2

Hi,

The Smartbear site has some pretty good guides, but to be more specific for what you have...

 

The below is the simplest of data-driven tests.  One datasource, the service to call and a loop.  This test will call the Rest request per row in the datasource.

ChrisAdams_0-1674818791167.png

 

Here is my datasource.  Like yours, it's a single column.

ChrisAdams_2-1674818903480.png

Note the properties section.  These align to our column(s) in the spreadsheet.  Also note I start at Row 2, this is because my spreadsheet contains a 'header row' and we don't want to pass a header to the service.

 

The datasource loop has to be 'bound' to the datasource and you also have to bind it to the first step inside the loop.

E.g.

ChrisAdams_3-1674819084609.png

This seems counter-intuitive, but it does work.  The GUI also displays a nice arrow to show the loop.

 

Your other question was "how to access the datasource value in a request".  To reference something in ReadyAPI, use the ${} syntax.  E.g. to reference the title for the current row in the datasource, use ${Books DataSource#title}.  The ${} styntax pulls in the value.  The bit before the hash is the step name of interest and the bit after the hash is the column.  So, if you added author as a another column in your spreadsheet, you'd add it to the properties section of the data source and reference it like ${Books DataSource#author}.

 

You don't have to type this though, the best bit is the 'Get Data' menu option.  If you right-click in the payload section, you'll see Get Data.  Click it. This opens a modal window that allows you navigate around your test and pick the value you want to insert.

ChrisAdams_5-1674819650793.png

 

ChrisAdams_4-1674819606833.png

 

ChrisAdams_6-1674819690055.png

The Get Data option is available everywhere in Ready API.  try right-clicking in fields or anywhere you'd expect to type.

 

 

 

 

Thanks

 

My new issue is

 

armygrad_0-1674839120980.png

It works fine on the 1st run through, however on the 2nd run it goes from Delay 7 to Cancel, i need it to run as it did for the 1st run on all subsequent runs.

 

Thanks

Fixed it, thanks

cancel
Showing results for 
Search instead for 
Did you mean: