Bypass or skip tests for a request

In addition to the above response, there’s also another way to directly control the skipping of the complete tests using some control boolean.

You can either use an environment variable or you can perform the computation in the test script whether you want to set a test (or a set of tests) and use that.

For eg:

let skipTest = pm.environment.get('skipTest');

(skipTest ? pm.test.skip : pm.test)("Check status code", () => {
    pm.expect(pm.response.code).to.equal(200);
});

(skipTest ? pm.test.skip : pm.test)("Check status code is not 404", () => {
    pm.expect(pm.response.code).to.not.equal(404);
});
3 Likes