首页 > 解决方案 > 有没有办法在邮递员中同时并行运行多个请求?

问题描述

我想检查接收服务器是否可以一次处理发送给它的多个请求。

标签: postman

解决方案


newman 命令行实用程序不是为并行发送多个请求而设计的

但您可以使用 powershell尝试多次运行集合。

$TargetPath=".\newman"
if (test-path ".\newman") {Remove-Item -r $TargetPath -Force}
New-Item -ItemType "directory" -path ".\newman\reports"
New-Item -ItemType "directory" -path ".\newman\logs"

For  ($i=0; $i -le 10; $i++) {
    $TestNewmanArgs="a.json -r cli,htmlextra --reporter-htmlextra-export newman\report-$i.html"
    $argz="run $TestNewmanArgs -k 
    "$i"
    Start-Process -FilePath "C:\Roaming\npm\newman" -ArgumentList $argz -PassThru
}

只需将其存储为 ps 文件,然后右键单击并使用 powershell 运行

这将在多个 cmd 进程中执行 newman

您还可以将 newmna 用作 nodejs 库并编写代码以并行运行脚本


推荐阅读