我在邮递员中有一个集合,其中包含很多请求,纽曼中是否有任何选项可以运行来自该集合的特定请求,而不是为该特定请求创建新文件夹并运行
答案 0 :(得分:6)
是的,您可以在Newman CLI中使用选项--folder
在集合运行器中运行特定请求。
文档:
CLI选项:-文件夹“名称”
运行特定文件夹/文件夹中的请求或集合中的特定请求。可以多次使用--folder来指定多个文件夹或请求,例如:--folder f1 --folder f2 --folder r1 --folder r2。
示例:
newman run "postman-collection-API" --environment "postman-environment-API" --folder request-name
答案 1 :(得分:0)
否,不可能使用newman从集合中运行单个请求。 请参阅newman command line options
答案 2 :(得分:0)
您还可以在 newman 库中运行特定请求,如下所示:
文档:
<块引用>options.folder
- 将运行的集合中的文件夹/文件夹 (ItemGroup) 的名称或 ID,而不是整个集合。
示例:
newman.run(
{
collection: 'postman-collection-API',
environment: 'postman-environment-API',
folder: ['request-name', 'other-request-name']
},
function (error, summary) {
console.log(`${summary.run.executions.length} requests were run`);
}
);