【问题标题】:Newman Docker error: unknown option `--url'纽曼 Docker 错误:未知选项 `--url'
【发布时间】:2019-03-21 21:08:49
【问题描述】:

我发现该选项是通过运行以下命令在 MAC 上运行带有 docker 映像和邮递员集合的 newman 的

docker pull postman/newman_ubuntu1404

docker run -t postman/newman_ubuntu1404 --url="https://www.getpostman.com/collections/8a0c9bc08f062d12dcda"

在带有邮递员集合的图像上运行 newman 时,会返回以下错误。

error: unknown option `--url'

Docker 版本为 Docker 版本 18.06.1-ce,构建 e68fc7a

支持吗?

【问题讨论】:

  • 在 docker 中我们没有像 --url 这样的参数。运行 docker run --help 以获取可用选项。此外,您可以使用“docker run -d --name 'mynewman' postman/newman_ubuntu1404”直接运行该映像。 url 参数应该做什么?

标签: docker collections postman newman


【解决方案1】:

我找到了这个github issue,上面写着用run 替换--url=

docker run -t postman/newman_ubuntu1404 run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda"

它似乎工作......

docker run -t postman/newman_ubuntu1404 run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda"
newman: Newman v4 deprecates support for the v1 collection format
  Use the Postman Native app to export collections in the v2 format

newman

newmanTest

→ GET with URL Params
  GET http://httpbin.org/get?lol=true [200 OK, 542B, 339ms]
  ✓  Response contains params

→ POST with JSON body
  POST http://httpbin.org/post [200 OK, 704B, 158ms]
  ✓  Check POST param in response

→ DELETE request
  DELETE http://httpbin.org/delete [200 OK, 606B, 184ms]
  ✓  Status code is 200

→ PUT with form data
  PUT http://httpbin.org/put [200 OK, 687B, 159ms]
  ✓  Test form data

┌─────────────────────────┬──────────┬──────────┐
│                         │ executed │   failed │
├─────────────────────────┼──────────┼──────────┤
│              iterations │        1 │        0 │
├─────────────────────────┼──────────┼──────────┤
│                requests │        4 │        0 │
├─────────────────────────┼──────────┼──────────┤
│            test-scripts │        4 │        0 │
├─────────────────────────┼──────────┼──────────┤
│      prerequest-scripts │        0 │        0 │
├─────────────────────────┼──────────┼──────────┤
│              assertions │        4 │        0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 1204ms                    │
├───────────────────────────────────────────────┤
│ total data received: 1.52KB (approx)          │
├───────────────────────────────────────────────┤
│ average response time: 210ms                  │
└───────────────────────────────────────────────┘

【讨论】:

  • url 标志取自下面的 Postman 文档,但这看起来可行,谢谢。 getpostman.com/docs/v6/postman/collection_runs/…
  • 很高兴为您提供帮助!如果您认为它可以解决您的问题,请不要忘记accept 作为答案。
  • 谢谢,会的。虽然它解决了问题并运行了集合,但一个问题是,如果集合还需要环境变量作为输入,那么如何将其添加到同一命令中?例如,当从 cmd 行使用 newman 运行时,它作为选项添加 -e Dev-Test-1-Env.postman_environment.json
  • 你能检查一下这些examples 是否真的有效吗?我认为他们涵盖了您的情况。
【解决方案2】:

问题中使用的 docker 映像现已过时,the new official image 提供了一个不使用“--url”的工作示例

码头工人拉邮递员/纽曼

docker run -t postman/newman run "https://www.getpostman.com/collections/8a0c9bc08f062d12dcda"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-08-17
    • 2020-03-18
    • 2019-04-13
    • 2014-10-13
    • 1970-01-01
    • 2020-12-14
    • 2017-05-20
    • 2014-09-23
    相关资源
    最近更新 更多