# Tests retrieved from collection variable - test failures stop subsequent tests from running

**URL:** <https://community.postman.com/t/tests-retrieved-from-collection-variable-test-failures-stop-subsequent-tests-from-running/25362>\
**Category:** Help Hub\
**Tags:** tests, shared-code, external-file\
**Created:** [June 30, 2021, 6:42pm UTC](https://community.postman.com/t/tests-retrieved-from-collection-variable-test-failures-stop-subsequent-tests-from-running/25362 "2021-06-30T18:42:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jshea](https://avatars.discourse-cdn.com/v4/letter/j/e9c0ed/32.png) [@jshea](https://community.postman.com/u/jshea)\
**Post date:** [June 30, 2021, 6:42pm UTC](https://community.postman.com/t/tests-retrieved-from-collection-variable-test-failures-stop-subsequent-tests-from-running/25362/1 "2021-06-30T18:42:29Z")

</div>

I have tests that I want to use in multiple API calls. Using JavaScript from external files has been an [open issue for 6 years now](https://github.com/postmanlabs/postman-app-support/issues/1180) but isn’t officially supported (yet). I’m [storing tests in collection variables](https://stackoverflow.com/a/54710287) so they can be retrieved in each APIs Tests. The issue is tests that fail stop execution like a general JS failure.

**Tests being stored in collection variables via an API’s Pre-req**

In an API call that also does setup (update collection variable values) I store the shared library of tests via a Pre-request Script. This is working fine.

![image](https://us1.discourse-cdn.com/getpostman/original/2X/7/7d6d70decbc562244d33b62f3081b73c1e836932.png)

**A “normal” test failure**

When a test is coded in an API’s Test area, failures don’t stop subsequent tests from running.

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/1/11fea213fa6ffa8c909af5f19369599f73e7b9bf.png)

**A failure for a test pulled in from a collection variable**

I can pull tests from the collection variable and run them just fine. However when a Chai expectation fails it seems to be treated like a JavaScript failure instead of an test/expectation failure.

The test run fails, subsequent tests for this API don’t run nor do other APIs in the collection run.

 ![image](https://us1.discourse-cdn.com/getpostman/original/2X/7/768ac83147efee1df54efe62e9f950620c6dcbee.png)

How can I have tests retrieved from a collection variable run/fail like hard coded tests?
