• <tfoot id='NNVO5'></tfoot>
    <legend id='NNVO5'><style id='NNVO5'><dir id='NNVO5'><q id='NNVO5'></q></dir></style></legend>
      <i id='NNVO5'><tr id='NNVO5'><dt id='NNVO5'><q id='NNVO5'><span id='NNVO5'><b id='NNVO5'><form id='NNVO5'><ins id='NNVO5'></ins><ul id='NNVO5'></ul><sub id='NNVO5'></sub></form><legend id='NNVO5'></legend><bdo id='NNVO5'><pre id='NNVO5'><center id='NNVO5'></center></pre></bdo></b><th id='NNVO5'></th></span></q></dt></tr></i><div id='NNVO5'><tfoot id='NNVO5'></tfoot><dl id='NNVO5'><fieldset id='NNVO5'></fieldset></dl></div>
        • <bdo id='NNVO5'></bdo><ul id='NNVO5'></ul>

        <small id='NNVO5'></small><noframes id='NNVO5'>

        如何在 CI 环境中运行 postman 的 newman?

        时间:2023-10-20

          • <bdo id='vryhG'></bdo><ul id='vryhG'></ul>
          • <tfoot id='vryhG'></tfoot>

            1. <legend id='vryhG'><style id='vryhG'><dir id='vryhG'><q id='vryhG'></q></dir></style></legend>

                <tbody id='vryhG'></tbody>
                  <i id='vryhG'><tr id='vryhG'><dt id='vryhG'><q id='vryhG'><span id='vryhG'><b id='vryhG'><form id='vryhG'><ins id='vryhG'></ins><ul id='vryhG'></ul><sub id='vryhG'></sub></form><legend id='vryhG'></legend><bdo id='vryhG'><pre id='vryhG'><center id='vryhG'></center></pre></bdo></b><th id='vryhG'></th></span></q></dt></tr></i><div id='vryhG'><tfoot id='vryhG'></tfoot><dl id='vryhG'><fieldset id='vryhG'></fieldset></dl></div>
                1. <small id='vryhG'></small><noframes id='vryhG'>

                  本文介绍了如何在 CI 环境中运行 postman 的 newman?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想在我的 CI 环境 (solano-ci) 上运行 newman.

                  I'd like to run newman on my CI environment (solano-ci).

                  newman 是一个在邮递员集合中运行请求的工具.

                  newman is a tool that runs through requests in your postman collection.

                  我的 package.json 中有一个 newman 脚本,我还有一个 npm start 脚本,它在 处启动服务器>localhost:3000.

                  I have a newman script in my package.json, and I also have a npm start script that starts the server at localhost:3000.

                  newman 已经配置了环境变量来测试端口 localhost:3000 上的端点.

                  newman is already configured with environment variables to test endpoints on port localhost:3000.

                  问题是我需要一个脚本来启动服务器 (npm start),然后运行 npm run newman.但是在服务器可用和 newman 运行它的测试之间存在延迟.如果 newman 在服务器可用之前运行,则每次测试都会出错.

                  The issue is I need one script that starts the server (npm start) and then runs npm run newman. But there's a delay between when the server is available and when newman runs it's tests. If newman runs before the server is available it results in an error for each test.

                  Error: connect ECONNREFUSED 127.0.0.1:3000
                  

                  现在这是我尝试使用 run-p 用于并行启动两个进程.然后我必须使用 sleep 并设置任意数量的等待时间以确保服务器准备就绪.

                  Right now here's what I tried using run-p which works at starting two processes in parallel. Then I have to use sleep and set an arbitrary number of time the wait to ensure that the server is ready.

                  "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"
                  

                  推荐答案

                  你可以使用 wait-on 包.

                  npm install --save-dev wait-on
                  

                  那么,

                  "newman-sleep": "wait-on http://localhost:3000 && npm run newman"
                  

                  这篇关于如何在 CI 环境中运行 postman 的 newman?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:在 Postman 中将多级响应对象可视化为表 下一篇:Postman - 如何计算 JSON 响应中特定对象的出现次数

                  相关文章

                2. <tfoot id='HJFfe'></tfoot>

                  <legend id='HJFfe'><style id='HJFfe'><dir id='HJFfe'><q id='HJFfe'></q></dir></style></legend>

                  • <bdo id='HJFfe'></bdo><ul id='HJFfe'></ul>

                    1. <i id='HJFfe'><tr id='HJFfe'><dt id='HJFfe'><q id='HJFfe'><span id='HJFfe'><b id='HJFfe'><form id='HJFfe'><ins id='HJFfe'></ins><ul id='HJFfe'></ul><sub id='HJFfe'></sub></form><legend id='HJFfe'></legend><bdo id='HJFfe'><pre id='HJFfe'><center id='HJFfe'></center></pre></bdo></b><th id='HJFfe'></th></span></q></dt></tr></i><div id='HJFfe'><tfoot id='HJFfe'></tfoot><dl id='HJFfe'><fieldset id='HJFfe'></fieldset></dl></div>

                      <small id='HJFfe'></small><noframes id='HJFfe'>