# How to know if test failed or passed from the TestScript tab

**URL:** <https://community.postman.com/t/how-to-know-if-test-failed-or-passed-from-the-testscript-tab/1386>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [April 6, 2018, 1:17pm UTC](https://community.postman.com/t/how-to-know-if-test-failed-or-passed-from-the-testscript-tab/1386 "2018-04-06T13:17:31Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![pageorge](https://avatars.discourse-cdn.com/v4/letter/p/3ec8ea/32.png) [@pageorge](https://community.postman.com/u/pageorge)\
**Post date:** [February 16, 2022, 5:58pm UTC](https://community.postman.com/t/how-to-know-if-test-failed-or-passed-from-the-testscript-tab/1386/4 "2022-02-16T17:58:48Z")

</div>

Just use a try {…} catch {…} pattern :

```auto
pm.test("your test(s)", function () {
  try {
    pm.expect(jsonData).to.be(…); // your test goes here
    
    test_succeeded = true;
  } catch (e) {
    test_succeeded = false;
    
    throw (e); // depending on wether you want to stop at the first failing test (default Postman behavior) or you want to perform all the tests, you may respectively add this line or remove it.
  }
…
  // repeat the try {…} catch {…} pattern for each one of your pm.expect() tests, if necessary
…

  // If you removed the "throw (e)" above, your pm.test() will always succeed, which is probably not what you want... 
  // In this case, you'll need to uncomment the following line :
  // pm.expect(test_succeeded, "at least one test failed").to.be.true;
}

```

---

_[View the full topic](https://community.postman.com/t/how-to-know-if-test-failed-or-passed-from-the-testscript-tab/1386)._
