Search code examples
command-linepostmannewman

What could cause a ".json is unexpected at this time" error when running a postman collection from command line using newman


I am attempting to use newman to run postman collection from the command line. I have been successful before, but with this most recent collection I am getting an error. I am using the following command

newman run [urlforjcollection] --reporters cli,json,html --reporter-json-
export C:\outputfile.json --reporter-
html-export C:\outputfile.html -e 
c:\QAEnvironment.json

This fails to run and I get the error .json was unexpected at this time. As I said I used this exact command on another collection and it worked fine.

Does anyone know what could case this issue? Is it something wrong with my command or is there some setting in postman that can cause it?


Solution

  • I Googled your error and it seems to be a problem with the command line rather than Postman; specifically, the need to use double quotes while specifying file locations. Try this:

    newman run [urlforjcollection] --reporters cli,json,html --reporter-json-
    export "C:\outputfile.json" --reporter-
    html-export "C:\outputfile.html" -e 
    "c:\QAEnvironment.json"