Next question - I can call every single question with this request and depending on the response I can call the next one with the same request.
I’m using this approach at the moment, but with many “Next question” POST requests.
My task is to call them with a single request.
How to do that using CSV file? The main thing is to check if every next question is the one that is expected.
That’s correct, I’m sending a request and it comes back with a ‘next question ID’.
Here you can see my body every time:
{
“answerBody”: {“value”: “{{answerBody}}”}, - different every time
“answerType”: {{answerType}}, - can be the same or different
“answerGroupId”: {{answerGroupId}}, - can be the same or different
“id”: {{id}} - next question’s ID (different every time)
}
So I need to repeat this until the last question. I also need to do it with a single request and using CSV file.
I hope it’s clear.
If I understood correctly, you need to take the id from response of your previous request and take other values from .csv file.
To do so you can update the environment or collection variable and set the questionId from there using test script. That value set can be used in next iteration. Rest values could be taken sequentially.
I am assuming, the response from the previous request looks as below.
{
“questionId”: “1234567890”
}
Test Script will look like: pm.environment.set(pm.response.json().questionId,'id');
In the above example, I have used environment variables, you may use global or collection based on the requirement.
This variable value will be accessible in the next run as now I have set to the environment. Once the run is completed it will update the value, that could be fetched from response of the request.