【问题标题】:What could cause a ".json is unexpected at this time" error when running a postman collection from command line using newman使用 newman 从命令行运行邮递员集合时,可能导致“.json 在此时意外”错误的原因
【发布时间】:2018-01-11 11:08:36
【问题描述】:

我正在尝试使用 newman 从命令行运行 postman 集合。我之前已经成功了,但是在最近的这个系列中,我遇到了一个错误。我正在使用以下命令

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

这无法运行,我收到错误 .json 在此时是意外的。正如我所说,我在另一个集合上使用了这个确切的命令,它工作得很好。

有谁知道这个问题会发生什么?是我的命令有问题还是邮递员中的某些设置可能导致它?

【问题讨论】:

  • 你能显示有效的命令吗?
  • 有效的命令是完全相同的命令,我只是指向不同的集合。
  • 我明白了.. 能否请您显示整个命令?
  • newman run [collection url] --reporters cli,json,html --reporter-json-export C:\outputfile.json --reporter-html-export C:\outputfile.html -e \Postman_Environment\BioPeoplev2.postman_environment

标签: command-line postman newman


【解决方案1】:

我用谷歌搜索了你的错误,这似乎是命令行而不是 Postman 的问题;具体来说,在指定文件位置时需要使用双引号。试试这个:

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

【讨论】:

  • 哇,由于某种原因,我在另一个上没有这个并且它起作用了,现在我想知道它有什么问题,但无论哪种方式都有效。
  • 在某些情况下不使用双引号也可以,但在所有情况下使用双引号是最安全的选择。干杯:)
猜你喜欢
  • 2016-07-24
  • 2019-12-14
  • 2017-02-11
  • 2017-11-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-23
  • 2022-08-21
相关资源
最近更新 更多