Tag: postman newman

我如何在CI环境中运行邮递员的纽曼?

我想在我的CI环境(solano-ci)上运行newman 。 newman是一个贯穿邮递员收集请求的工具。 我在我的package.json有一个newman脚本,我也有一个npm start脚本启动服务器localhost:3000 。 newman已经configuration了环境variables来testing端口localhost:3000上的端点。 问题是我需要一个启动服务器的脚本( npm start ),然后运行npm run newman 。 但是,当服务器可用时和newman运行它的testing之间有一个延迟。 如果newman在服务器可用之前运行,那么每个testing都会导致错误。 Error: connect ECONNREFUSED 127.0.0.1:3000 现在这里是我尝试使用run-p并行启动两个进程。 然后,我必须使用sleep并设置任意数量的等待时间,以确保服务器已准备就绪。 "newman": "newman -c ./postman/api.postman_collection.json -e ./postman/local.postman_environment.json", "newman-sleep": "sleep 10 && npm run newman", "newman-server": "run-p start newman-sleep"