# Mark a script as a failure

**URL:** <https://community.postman.com/t/mark-a-script-as-a-failure/12556>\
**Category:** Help Hub\
**Created:** [May 11, 2020, 7:59pm UTC](https://community.postman.com/t/mark-a-script-as-a-failure/12556 "2020-05-11T19:59:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dmhunter](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/dmhunter/32/4399_2.png) [@dmhunter](https://community.postman.com/u/dmhunter)\
**Post date:** [May 11, 2020, 7:59pm UTC](https://community.postman.com/t/mark-a-script-as-a-failure/12556/1 "2020-05-11T19:59:39Z")

</div>

Hi,

I am new to postman, so please forgive me if I’m asking a dumb question.

I have a postman request.  
It runs.  
I have stuff in the request test section where I have coded several tests.  
If any of these tests fail, I get an assertion error reported at the end.  
However, the request itself is not marked as a failure.

How do I cause a request to be marked as a failure?  
I not talking about another assertion failure, but a request failure.

The following test is being run thru newman.  
As you can see I have two assertion errors.  
But the request is still marked as a success.

If this isn’t possible; I won’t like it, but I will have an answer.

Thanks

* * *

## | | executed | failed | --------------------------±----------------------±----------------------- | iterations | 1 | 0 | --------------------------±----------------------±----------------------- | requests | 2 | 0 | --------------------------±----------------------±----------------------- | test-scripts | 4 | 0 | --------------------------±----------------------±----------------------- | prerequest-scripts | 4 | 0 | --------------------------±----------------------±----------------------- | assertions | 2 | 0 |

| total run duration: 4m 0.9s |
| --- |
| total data received: 477B (approx) |

* * *

| average response time: 2m 0.3s [min: 5.3s, max: 3m 55.3s, s.d.: 1m 55s] |
| --- |

---

<div class="post-metadata">

**Author:** ![hannah.neil](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/hannah.neil/32/4477_2.png) [@hannah.neil](https://community.postman.com/u/hannah.neil)\
**Post date:** [May 15, 2020, 9:18pm UTC](https://community.postman.com/t/mark-a-script-as-a-failure/12556/2 "2020-05-15T21:18:34Z")

</div>

Hi @dmhunter – there is no such thing as a dumb question here!

Maybe adding in an assertion for the status code would help?

---

<div class="post-metadata">

**Author:** ![kevin.swiber](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kevin.swiber/32/3820_2.png) [@kevin.swiber](https://community.postman.com/u/kevin.swiber)\
**Post date:** [May 15, 2020, 11:51pm UTC](https://community.postman.com/t/mark-a-script-as-a-failure/12556/3 "2020-05-15T23:51:19Z")

</div>

Hey @dmhunter,

A request failure indicates a connection-level failure (likely on the TCP, DNS, or TLS level).

If you want custom reporting to show the entire request as a failure if all its assertions fail, you can either build a custom reporter or see if a community-supported reporter exists already. Here are a few, but more can be found on [npmjs.com](http://npmjs.com): [https://github.com/postmanlabs/newman#community-maintained-reporters](https://github.com/postmanlabs/newman#community-maintained-reporters)

---

<div class="post-metadata">

**Author:** ![kclausing](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/kclausing/32/5133_2.png) [@kclausing](https://community.postman.com/u/kclausing)\
**Post date:** [August 4, 2020, 3:24pm UTC](https://community.postman.com/t/mark-a-script-as-a-failure/12556/4 "2020-08-04T15:24:36Z")

</div>

I agree with Hannah.Neil. You can add a check such as this, it checks the status response from the api call.

pm.test(“Status code is 201”, function () {

```
pm.response.to.have.status(201);

```

});
