# Add collection level tests and pre-request scripts automatically

**URL:** <https://community.postman.com/t/add-collection-level-tests-and-pre-request-scripts-automatically/12363>\
**Category:** Help Hub\
**Tags:** swagger, collections, newman-project, pre-request-script, tests\
**Created:** [May 4, 2020, 3:17pm UTC](https://community.postman.com/t/add-collection-level-tests-and-pre-request-scripts-automatically/12363 "2020-05-04T15:17:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![egorbunov](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@egorbunov](https://community.postman.com/u/egorbunov)\
**Post date:** [May 4, 2020, 3:17pm UTC](https://community.postman.com/t/add-collection-level-tests-and-pre-request-scripts-automatically/12363/1 "2020-05-04T15:17:48Z")

</div>

Hi!

I am generating a new collection based on the swagger specification.  
Next, I want to automatically add collection level scripts and tests to this collection.  
Is there such an opportunity through NPM libraries?

Ideally, any updates in the swagger should trigger the creation of a new collection, which will be automatically checked.  
I did not find any options to store tests **outside** the \*.json collection. It is impossible to refer to **external tests** through any option.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [December 12, 2024, 12:59pm UTC](https://community.postman.com/t/add-collection-level-tests-and-pre-request-scripts-automatically/12363/2 "2024-12-12T12:59:15Z")

</div>

Closed on December 12, 2024, 12:59pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
