Re-run test script without re-sending request

Hi folks,

I want to be able to re-run the test script multiple times after Sending the request.

This feature is useful when building the test suite.

Is there a way to achieve this?

Thanks,

Kunal

1 Like

Hi Kunal,

Thanks for reaching out! Welcome the Community. :slight_smile:

Have you considered looping your whole Test script (i.e. put the whole script in a for loop)? There isn’t a way right now to run just a Test script detached from a request right now.

Being able to re-run a test would be super useful while writing and refining it.

Hey @gabriel-r , like in the above answer, wouldn’t looping help?

Hi @meenakshi.dhanani

Not sure how looping would help me or the OP.
Looping would rerun the request and not allow edits between runs.

My need (and OP’s, I believe) is to be able to just run the current test on the already present response.

This is even more relevant when using paid services where every request is money, and you need to make hundreds while building the test suite.

Looping in the tests tab will run the same code multiple times for the one response received. There could be other hacks in Postman as well I’m thinking. But it would help you can share an example use case? I’m interested in understanding the need a bit more.

Thanks :smiley:

The use case is “using the Test tab as an IDE”.

  1. Set up the request and its parameters
  2. Run the request, see if it works, check out the response
  3. Start editing the Tests

This 3rd step will take a while. I have more than a couple of variables, different tests, environment variables, looping through different requests, etc.

During this, I want to run the Test like 100 million times, output stuff to the Console, check values and formats, try 10 times until I get the right JSON path for some value in the response, etc.

During this Test editing, I want is to simply rerun the test alone, without re-running the request.

Does it make sense?

Thanks for sharing with so much detail, really appreciate it.

I’m thinking of a workaround, let’s say you hit the API once, save the response as an example response and spin up a mock server in postman that will return the response that the original API returns. Since this is a mock, you can hit it as many times as you like, unlike the original API.

I’ll try this out in a while and share a link to the public workspace solution.

What do you think? Does that sound like a possible solution?

1 Like

Sounds fancy and super useful :slight_smile:
Many thanks!

run-test-without-resend
Hey @gabriel-r, this use recently came up for me and I created a mock server to test all the code in the pre-request and test scripts. Made a short walkthrough for you :slightly_smiling_face:

3 Likes

This sounds perfect! Can’t wait to try it out as soon as I get back to this project.

PS: @kunal This seems to be the answer you were looking for?

1 Like