postman-collection-runner - 在邮递员中组合多个集合
问题描述
我正在尝试在詹金斯一次运行多个邮递员收藏
下面是我的场景 collection1.json,其中 data1.csv 和环境变量为 environment1.json collection1.json 与 data1.csv 和环境变量为 environment1.json
我想一次性运行上面的集合 - 请让我知道如何组合 2 个集合并一次运行?- 有没有办法一次下载邮递员中的每个集合而不是一个一个地下载?-使用邮递员收集组合的示例
解决方案
我知道 Postman collection runner 有一些限制,但我能够使用这篇文章实现它
这是允许您并行运行多个 Postman 集合的脚本:
const path = require('path')
const async = require('async')
const newman = require('newman')
const PARALLEL_RUN_COUNT = 2
const parametersForTestRun = {
collection: path.join(__dirname, 'postman/postman_collection.json'), // your collection
environment: path.join(__dirname, 'postman/localhost.postman_environment.json'), //your env
reporters: 'cli'
};
parallelCollectionRun = function (done) {
newman.run(parametersForTestRun, done);
};
let commands = []
for (let index = 0; index < PARALLEL_RUN_COUNT; index++) {
commands.push(parallelCollectionRun);
}
// Runs the Postman sample collection thrice, in parallel.
async.parallel(
commands,
(err, results) => {
err && console.error(err);
results.forEach(function (result) {
var failures = result.run.failures;
console.info(failures.length ? JSON.stringify(failures.failures, null, 2) :
`${result.collection.name} ran successfully.`);
});
});
推荐阅读
- react-native - ScrollView 中的 FlatList 在 React Native 中不起作用
- ffmpeg - 通过没有 SDP 文件的 FFmpeg 播放 RDT(真实数据传输)
- python - How can I get an object with multiple parameters in django?
- java - 如何在像kotlin这样的java类中传递参数
- flutter - Await putfile never finishes flutter firebase storage
- rust - actix_web How to get the response body from awc::client::ClientResponse
- c++ - Unknown Runtime When Using c++11 instead if c++14
- datetime - 如何在批处理文件中按日期时间创建文件夹
- jquery - this jquery validation prevent me to post form data, without this all is working fine
- python - 在 python 上使用 selenium 抓取动态网站