在GitLab中的docker上运行邮递员脚本时遇到2个错误。相同的脚本通过Postman和Newman运行正常

时间:2018-10-16 16:38:08

标签: gitlab postman newman

尝试在GitLab中的Docker上运行邮递员脚本(collection.json)时,出现两个错误,如附件的屏幕截图所示。以下是有关我的系统设置的详细信息:

  1. 纽曼版:4.1.0
  2. 操作系统详细信息:Windows 7,64位
  3. 预期的行为:我应该获得状态代码200,并且我的断言应该通过。
  4. 用于运行纽曼的命令/脚本:纽曼运行Generate_Access_Token.postman_collection.json --reporters cli,html --reporter-html-export report.html
  5. 使用的收藏集:

    { “信息”:{ “ _postman_id”:“ 392fa8ba-2f61-43df-be6e-ea06cbf07bb5”, “ name”:“ Generate Access Token”, “模式”:“ https://schema.getpostman.com/json/collection/v2.1.0/collection.json” }, “项目”:[ { “ name”:“ GenerateAccessToken”, “事件”:[ { “ listen”:“测试”, “脚本”:{ “ id”:“ b0219bcc-2961-421e-ada5-66c3fcd7096e”, “ type”:“文本/ javascript”, “ exec”:[ “ pm.test(”状态码为200“,函数(){”, “ pm.response.to.have.status(200);”, “});” ] } } ], “请求”:{ “ auth”:{ “ type”:“ noauth” }, “ method”:“ POST”, “标题”:[ { “ key”:“ Content-Type”, “值”:“应用程序/ json” }, { “ key”:“ correlationId”, “值”:“ 04ef78f3-7f50-497b-9a78-4caf870cac0c” }, { “ key”:“ client_secret”, “值”:“ 1925eB20B16c4560a330850e7E4b2C0a” }, { “ key”:“ client_id”, “值”:“ 40297376d0e74f61ad51427254c3302e” } ], “身体”: { “ mode”:“ raw”, “生的”: ”{}” }, “ url”:{ “ raw”:“ https://api-exp-dev.lfg.com/api/esignature/generateAccessToken”, “ protocol”:“ https”, “主持人”:[ “ api-exp-dev”, “ lfg”, “ com” ], “路径”:[ “ api”, “签名”, “ generateAccessToken” ] } }, “响应”:[] } ] }

  6. gitlab-ci.yml文件

    阶段:     -测试

    postman_tests:     阶段:测试     图片:         名称:postman / newman_alpine33         入口点: [””]     脚本:         -纽曼--version         -npm install -g newman-reporter-html         -纽曼(Newman)运行Generate_Access_Token.postman_collection.json- 记者cli,html --reporter-html-export report.html     工件:         时间:总是         路径:             -report.html

enter image description here

1 个答案:

答案 0 :(得分:0)

它对我有效,在run语句的末尾添加了--insecure。新的语句如下所示:

  • newman运行Generate_Access_Token.postman_collection.json --reporters cli,html --reporter-html-export report.html-不安全