Could expand the view of the request builder to show the request tabs, do any of these have orange dots on them. Not sure what you mean by âgreenâ the tab shouldnât show any colour.
Have the created a new run or are you retrying the same one as before?
Ok. It works after reimporting the data file. But thereâs still a problem; it creates requests even when the agent_id is empty. Is it possible to set conditions on the requests (drop request is variable value if null/empty)?
Something that Iâve done to handle this scenario is just to change the url the request is hitting via the prerequest script. Letâs take an example.
Say you donât want to execute the request when gadget_id is null. You could do something like this in your prerequest script;
const gadgetId = pm.iterationData.get('gadget_id');
if(!gadgetId) {
pm.request.url = 'https://postman-echo.com/delay/0';
pm.request.method = 'GET';
pm.variables.set('skip', true);
}
else {
// If you need to do any other preprocessing if gadget_id exists
}
This will still execute a request, but instead of hitting your API, it will hit the postman echo api.
Since you donât want tests to run (because your api didnât actually run), youâd want to add this to your tests tab:
const skip = pm.variables.get('skip');
if(!skip) {
// all of your tests for your API
}
Essentially youâre just putting your tests behind an if statement to make sure they arenât run if you âskippedâ the request.
Iâve figured it out (created tests based on the entries in the data file (expect to fail and expect to pass)) based on whatâs being read (in this case the gadget_id).