Issue with pm.execution.setNextRequest(null)

Hi why the pm.execution.setNextRequest(null); is not working for me ? This is my error :

Script Error:Cannot read properties of undefined (reading 'setNextRequest')

Thanks

Hello, could you please share more details about your specific use case? It would be helpful if you could provide your test scenario so we can better assist you with a suitable solution.

I have actually 2 test scenario : Setup & Clean

If a someone does a test using the setup but not the clean and run the setup a second time I want to stop the current test and say an error.

To do that I did :

if (pm.environment.get("rsEmailTest")) {
    pm.execution.setNextRequest(null);
    throw new Error("⛔ You didn't run the Clean test collection to perform a complete cleaning of your tests.");
}

But I got the error Script Error:Cannot read properties of undefined (reading 'setNextRequest')

Hello, you can use the visual step components to build your test scenario more easily. Try using a conditional branch: if rsEmailTest is empty, execute the setup test case; if not, skip it and throw an error. Flow control conditions - Apidog Docs
2c22fed2-680c-4846-a78c-f688c0d108e8.jpeg

I was like that before but I have actually a lot of tests so I don’t know if I can just fix the setNextRequest?

Hello, I’d love to dig a little deeper. When using flow-control-conditions, what parts do you find tricky or hard to work with? Also, you mentioned running a lot of tests—are these tests mostly centered around specific business scenarios or API workflows?

I actually found out how can I use your flow control conditions as my advantage, and I’ll use that, it will be cool if there is any fix for the setNextRequest() :slightly_smiling_face: Thanks

Did you import your data from Postman and have many places using setNextRequest? We’ll consider adding this compatibility in future updates.

Not really, I just found this in function of pm. so I look up the doc and wanted to try :slightly_smiling_face: