setNextRequest in Pre-Request - Skipping Call?

If I have say 3 steps, A/B/C.
Depending on env conditions, I want to skip the execution of Step A and go straight to B/C.

If I set a setNextRequest("Step B") statement in the pre-req tab of Step A, it still executes Step A and then applies the workflow.

Is there a better way to do something like this? I know this would generally only be the case if the very first call is the one I want to skip. Is the only real way around this by adding a step before Step A?

Thx

4 Likes

@tmccann

Our API set has a “ping” endpoint that is used to test to see if the server is up. It simply returns …

{
    "ping": "Hello world."
}

If you have something like that or some sort of other diagnostic endpoint that could be run first, you could use that in your collection to test the environment in the “test” script and then decide if you need to skip A

So you would have … ping/A/B/C

3 Likes

Moving this to feature request.

@kamalaknn @harryi3t - this is a fine example of pm.break , etc

4 Likes

@dhoyt This is kind of along the lines of what I was thinking but I do like your idea of the “Hello World” bit. I will implement something like that as well, clean and simple :slight_smile:

@shamasis Thanks for putting this into a FR, it would be really nice to have something like this where we can evaluate before the call is made.

It’s critical for us to have a way to skip a request in the pre-script. The current call doesn’t always know which call should be next, but it does know if it should run or not. Without this, our Postman collection is a fragile and unreadable mess, where calls can’t even be renamed without breaking the entire flow.

1 Like

If something is implemented where you can skip a request in the pre-script, there should be a part of the test results that shows how many requests were skipped.

1 Like

@jrsiegel That’s a great idea. Could you create a feature request here: https://github.com/postmanlabs/postman-app-support/issues/new?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.