Reputation: 428
I am trying to run the Postman Collection JSON file in the CMD and in Jenkins. All the Test Scripts, null check validation, Schema Validation has been failing in CMD and in jenkins. The same Collection is passing in Postman's collection runner.
I have used Environment variables for the API Endpoint, credential and Authentication Token.
My Question - Are the Environment Variables mapped/recorded in the JSON Collection file during the Export? If not, then how do I map/record Environment variables within JSON Collection File?
FOR the Schema validation, Newman is unable to read/load the Scehema from git link.
Upvotes: 2
Views: 2120
Reputation: 1
I am able to configure and execute postman/newman build with the jenkins with the use of postman collection's environment variable and its working fine.
The issue is when I try to use global variable file along with the main collection and environment variable. It's not working, Jenkins does not identify the global variable.
my batch command is:
'PATH of the local system folder'/newman run 'PATH of the local system folder'/Login-Jenkins.postman_collection.json
-e 'PATH of the local system folder'/Login.postman_environment.json
--globals 'PATH of the local system folder'/Local_Build.postman_globals.json
--insecure
Upvotes: 0
Reputation: 25929
It's not failing in the Collection Runner because you have selected the separate environment file in the UI. You can tell this from the title, at the top of the collection run summary.
The environment variables are contained in a separate exportable file, you would need to get a copy of this from the 'Manage Environment' section of the application. More information about how to do this can be found here.
To use the file in the command line using Newman, you need to use the -e
argument followed by the environment file.
For example:
newman run <collection file> -e <environment file>
All the CLI arguments can be found here on the documentation.
Upvotes: 3