导出 collection 为 collection.json:
导出 environment 为 environment.json:
3. 执行 API 测试
我们只需要基于导出的 collection.json 和 environment.json 执行一条 docker 指令即可完成 API 测试:
docker run --rm -i -v /root/postman:/etc/newman
–entrypoint sh postman/newman:alpine -c
‘npm i -g newman-reporter-html;
newman run collection.json
–suppress-exit-code 1
–color off
–reporters cli,html
–reporter-html-export api_report.html
–environment=environment.json’
指令解析: