Describe the bug
I need to do multiple requests using JSON for my API changing the ID of request.
I have tried to create a loop of request using variables but did not have success.
Specifications of my test
Enviroment Name: Test
Enviroment Variables:
Variable: index
Initial value: 0
Current value: 0
Params have nothing.
Authorization is empty.
Headers
Key: Content-Type
Value: application/json
Body
{ “ID”: {{index}} }
Pre-request Script
pm.environment.set("index", String(parseInt(pm.environment.get("index"))+1));
Tests
if (parseInt(pm.environment.get("index")) < 10)
{
postman.setNextRequest("API Address");
}
else
{
postman.setNextRequest(null);
}
App information (please complete the following information):
- Java Servlet.
- Postman v7.6.0
- Local machine: Windows 10; Server: Linux Ubuntu.
Thanks for helping.