简体   繁体   中英

Can I rename the package.json file?

I'm running Postman tests via Newman using files that are in a Git repository. That works fine. My issue is I have multiple sets of tests, each test has it's own Jenkins job that triggers when a build is successful. I'm trying NOT to use multiple git repositories to host these files.

The tests are run using a package.json file like this:

 {
   "name": "postmanfiles",
   "version": "1.0.0",
   "description": "project to store postman collection",
   "main": "index.js",
   "scripts": { "api-tests": "newman run --verbose --timeout 8000000 --reporters 'cli,testrail' 'SearchAPI.postman_collection.json' -e 'My_Environment.postman_environment.json'" },
   "keywords": [ "Postman", "CI" ],
   "author": "Joe Smith",
   "license": "ISC",
   "dependencies": { "newman": "^6.14.10"
 }

I have multiple Postman collections, for example, 'SearchAPI.postman_collection.json', 'ModifyAPI.postman_collection.json', etc for each set of tests.

In order to not use multiple Git repos for these tests I need multiple package.json files in one repository because I have five different Postman collections to run. Each Jenkins job triggers off of separate builds. An easy way to do this would be to have five different uniquely named package.json files in one Git repository.

But can I do that and if so how?

Or is there an easier way to do this?

As far as I know you can't. Which is why we use tools like Grunt/Gulp or Webpack to get complex build workflows done.

I got this to work by specifying multiple tests inside package.json and then having unique Jenkins scripts in the repository, one for each set of tests.

   "scripts": {
"api-tests": "newman run --verbose --timeout 8000000 --reporters 'cli' 'SearchAPI.postman_collection.json' -e 'CTV_Environment.postman_environment.json'",
"site-tests": "newman run --verbose --timeout 8000000 --reporters 'cli' 'SiteAPI.postman_collection.json' -e 'CTV_Environment.postman_environment.json'"

},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM