Is it possible to assign the status of the test to any variable or constant?

My question: I want to see whether is it possible to assign the status of the response to any variable or constant? I want to have the if condition where if status is “201 created” then particular test cases should not run.

Thank you:)

The response code is available in script as pm.response.code, so you could do something like this:

if(pm.response.code != 201) {
  pm.test("This test is safe to run", function () {
    // Write whatever you want to test in here
  }
}
1 Like

Thank you very much @neilstudd. You are amazing.