setNextRequest is running my request on loop but using only the 1st row of testdata file

Hello Everyone,
I have gone through several post and discussion, but couldn’t get solution for my issue.

My issue: I have 5 request API where i have to run 4 request onetime only and the 5th API needs to be run 12 iterations. I am using TestData.csv file. Please help me how to solve it. Thanks in advance!!

image

The Collection runner would normally run through all requests for each line of data in the CSV which doesn’t sound like it’s what you are trying to achieve.

This does sound like a scenario where you might have a pre-req script to perform the first 4
steps and you then have a single request which is run 12 times.

The problem I think with this is that sendRequest (which is how I would suspect the requests need to be coded in the pre-req) is asynchronous so even those also have to be layered correctly to ensure they run in the right order.

In this scenario, you aren’t really testing the first four requests, but you do need to put in some logic that ends the run if the appropriate responses aren’t returned that enables the 5th request to run.

In the run settings, there is an iterations field that you need to set, but I thought I read somewhere that for a CSV, it will run once of each line irrespective. (I haven’t tested this though). I don’t think this is your problem though.

my execution sequence is like:
1- Run BFF - Get the Token
2- Run x-user- Get another token
3- Post/Parties- Create the PartyID using the request body.(Here i am passing those two tokens)
4- Get/Parties- Using the PartyID generated in the response of Post/Parties API
5- Now in the Patch/parties- I want to update all the party information like Name, Address, Phone number with various testdata.

and it should run till the data i am having not endlessly.

I can’t see how this will work, as the collection will run x times based on the lines of data in the CSV, which isn’t what you want.

Another option is to format a JSON string with all of the data you want, and put that in your CSV file as a single entry. Import that JSON string and parse it into a JavaScript array, and in the Tests tab for request 4 (Get Parties), you can have a for each loop using the JavaScript array and sendRequest.

Thanks for replying… But its not solving my issue. and the 2nd option you are saying i will try it out.

@danny-dainton . Could you please help me in this… i couldn’t find a solution to this.