# Skipping a test at the parent level

**URL:** <https://community.postman.com/t/skipping-a-test-at-the-parent-level/14778>\
**Category:** Help Hub\
**Tags:** monitors, tests, collections\
**Created:** [August 6, 2020, 11:55am UTC](https://community.postman.com/t/skipping-a-test-at-the-parent-level/14778 "2020-08-06T11:55:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ButtockFlesh](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@ButtockFlesh](https://community.postman.com/u/ButtockFlesh)\
**Post date:** [August 6, 2020, 11:55am UTC](https://community.postman.com/t/skipping-a-test-at-the-parent-level/14778/1 "2020-08-06T11:55:48Z")

</div>

I have the following test defined at the parent level which runs for all tests.

```
pm.test('Parent response status code should be 200', function () {
    pm.response.to.have.status(200);
});

```

I temporarily have a page which gives a 404 and which I want to skip but not delete. Ideally I would be able to disable it but can’t see how to do that. So I tried the following pre-release script but it doesn’t work and still runs the test, which makes my monitor fail every day.

```
var testID = pm.info.requestName;
console.log(testID);
if(testID == "Calendar") {
    postman.setNextRequest(null);
};

```

Is there a way I can either disable/skip my test until such a time as it will work and I can reenable it?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [August 6, 2020, 12:08pm UTC](https://community.postman.com/t/skipping-a-test-at-the-parent-level/14778/2 "2020-08-06T12:08:55Z")

</div>

You could edit the parent test like this and it will skip if the status code is 404:

```
let skipTest = pm.response.code === 404;

(skipTest ? pm.test.skip : pm.test)("Parent response status code should be 200", () => {
    pm.response.to.have.status(200);
});

```

 ![Screenshot 2020-08-06 at 13.10.08](https://us1.discourse-cdn.com/getpostman/original/2X/8/8ea5bc57f7e104a91c854cff0d9be1a8c44e8e8e.png)

 ![Screenshot 2020-08-06 at 13.09.19](https://us1.discourse-cdn.com/getpostman/original/3X/5/5/55639995c5108e5fb02877dac763fff39341991f.png)

---

<div class="post-metadata">

**Author:** ![ButtockFlesh](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@ButtockFlesh](https://community.postman.com/u/ButtockFlesh)\
**Post date:** [August 6, 2020, 12:21pm UTC](https://community.postman.com/t/skipping-a-test-at-the-parent-level/14778/3 "2020-08-06T12:21:31Z")

</div>

That would work, only problem is I want to know if the other tests give a 404. This particular one is because there is no data. I suppose I could set an extra response variable in some way to distinguish it?

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [August 6, 2020, 12:33pm UTC](https://community.postman.com/t/skipping-a-test-at-the-parent-level/14778/4 "2020-08-06T12:33:42Z")

</div>

Yeah this has a downside of skipping a request that you don’t want, like someone changing the route of a certain other endpoint and you wouldn’t capture that issue here as it would be skipped.

You could pair it with the `requestName` ?

```
let skipTest = pm.response.code === 404;

(skipTest && pm.info.requestName === "Calendar" ? pm.test.skip : pm.test)("Parent response status code should be 200", () => {
    pm.response.to.have.status(200);
});

```

So that will legit fail if the other requests give a 404 response as the name wouldn’t match and fail the condition.

You could even change the assertion slightly to also tell you the request name in the failed assertion:

```
let skipTest = pm.response.code === 404;

(skipTest && pm.info.requestName === "Calendar" ? pm.test.skip : pm.test)("Parent response status code should be 200", () => {
    pm.expect(pm.response.code, `Request Name: ${pm.info.requestName}`).to.equal(200);
});

```

 ![Screenshot 2020-08-06 at 13.33.16](https://us1.discourse-cdn.com/getpostman/original/2X/6/61c93592155fc604eccdb8d42e136c4578268614.png)

---

<div class="post-metadata">

**Author:** ![ButtockFlesh](https://avatars.discourse-cdn.com/v4/letter/b/b5e925/32.png) [@ButtockFlesh](https://community.postman.com/u/ButtockFlesh)\
**Post date:** [August 6, 2020, 5:18pm UTC](https://community.postman.com/t/skipping-a-test-at-the-parent-level/14778/5 "2020-08-06T17:18:19Z")

</div>

Cool, yeah that works. When the endpoint is working again I’ll just have to remember to turn the test back on.
