Forum Discussion
- ChrisAdamsChampion Level 3
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.
Here is my datasource. Like yours, it's a single column.
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.
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.
The Get Data option is available everywhere in Ready API. try right-clicking in fields or anywhere you'd expect to type.
- armygradContributor
how do i get the loop to work?
Related Content
- 6 years ago
- 3 years ago
Recent Discussions
- 8 hours ago
- 24 hours ago