首页 文章

我在GitLab中的docker上运行postman脚本时遇到2个错误 . 通过Postman和Newman,同样的脚本正常运行

提问于
浏览
0

尝试在GitLab中的docker上运行我的postman脚本(collection.json)时,我收到了两个错误,如附带的屏幕截图所示 . 以下是有关我的系统设置的详细信息:

  • 纽曼版本:4.1.0

  • 操作系统详细信息:Windows 7,64位

  • 预期行为:我应该将状态代码设置为200并且我的断言应该通过 .

  • 用于运行Newman的命令/脚本:newman运行Generate_Access_Token.postman_collection.json --reporters cli,html --reporter-html-export report.html

  • 使用的收藏品:

{"info":{"_postman_id":"392fa8ba-2f61-43df-be6e-ea06cbf07bb5","name":"Generate Access Token","schema":“https://schema.getpostman.com/json/collection/v2.1.0/collection.json " }, "项目": [ { "名": " GenerateAccessToken ", "事件": [ { "听": "测试", "脚本": { " ID ": " b0219bcc-2961-421e-ada5-66c3fcd7096e ", "型": "文/ JavaScript的", " EXEC ": [ " pm.test("Status code is 200",function(){", " pm.response.to.have.status(200); ", "}); " ] } } ], " request ": { " auth ": { " type ": " noauth " }, " method ": " POST ", " header ": [ { " key ": " Content-Type ", "值": "应用/ JSON " }, { "键": "的correlationID ", "值": " 04ef78f3-7f50-497b-9a78-4caf870cac0c " }, { "键": " client_secret ", "值": " 1925eB20B16c4560a330850e7E4b2C0a " }, { "键": " CLIENT_ID ", "值": " 40297376d0e74f61ad51427254c3302e " } ], "体": { "模式": "原料", "生": " {} 1211 564 url ": { " raw ": " https://api-exp-dev.lfg.com/api/esignature/generateAccessToken ", " protocol ": " https ", " host ": [ " api-exp-dev ", " lfg ", " com " ], " path ": [ " api ", " esignature ", " generateAccessToken " ] } }, " response“:[]}]}

  • gitlab-ci.yml文件

阶段: - 测试

postman_tests:stage:test image:name:postman / newman_alpine33 entrypoint:[“”] script: - newman --version - npm install -g newman-reporter-html - newman run Generate_Access_Token.postman_collection.json - reporter cli,html - -reporter-html-export report.html工件:when:always paths: - report.html

enter image description here

1 回答

  • 0

    它通过在我的运行声明结束时添加--insecure为我工作 . 新声明如下所示:

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

相关问题