newman run "Second.json" -e "Environment.postman_environment" -g "workspace.postman_globals.json" -d "Second.csv" -r htmlextra --reporter-htmlextra-export "Path for HTMLReport"
After executing above commands on command line with or without -r htmlextra --reporter-htmlextra-export "Path for HTMLReport"
I get below below error for the second command:
Unexpected token ‘U’ at 1:1
Unauthorized
Can anyone please give their suggestion what needs to be done to resolve this.
Hey @docking-module-phys2
Welcome to the Postman community
I can’t really see how that would work and set any global value that the second run could use here. Those are both independent runs.
Within the app, you’re doing all this in a Workspace and those variables are stored at the global level in the current value (If that’s set via a script). Even if the Globals were exported, those current values wouldn’t be in that exported JSON file.
It’s worth opening up those exported files in a text editor to check the contents.
What variables are actually used during the Collection Run?
You should be able to see that in the report when using the --reporter-htmlextra-showEnvironmentData
and --reporter-htmlextra-showGlobalData
flags.
Hey @danny-dainton
Thanks for replying.
Yes, I tried --reporter-htmlextra-showEnvironmentData
and --reporter-htmlextra-showGlobalData
flags and found second collection is not taking Globals set runtime from first collection.
I have requirement where there are multiple collections and each collection has its own csv as an input. First collection generates access token, some other parameters and all other collections should take those globals set i.e. ‘access token’, other parameters’ as an input to generate their respective results.
I even tried below in Newman:
newman run "FirstAuth.json" -e "Environment.postman_environment" -d "First.csv" --export-environment "Path for Enviroment.json" -r htmlextra --reporter-htmlextra-showEnvironmentData --reporter-htmlextra-showGlobalData --reporter-htmlextra-export "Path for HTMLReport"
In above command I have exported environment and in below command have take exported environment as an input
newman run "Second.json" -e "Exported Environment Json" -d "Second.csv" -r htmlextra --reporter-htmlextra-showEnvironmentData --reporter-htmlextra-showGlobalData --reporter-htmlextra-export "Path for HTMLReport"
Report generated for second command shows environment variable generated from first command.
Still I am getting same Json Error.
Any suggestion what needs to be done to resolve this.
What does the request data (Request Params/Request Headers/Request Body) look like for those failed ones - Are the values from the environment file actually getting set correctly?
Do you still have references to getting those values from the global scope in the Collection?
Without more information and seeing what you have in place, it’s difficult to know what’s going on here. Just looking at those commands doesn’t really give you the full picture.