我想从POSTMAN Google Chrome扩展程序中发布数据。我想用不同的数据发出10个请求,它应该是同一时间。
在POSTMAN中可以这样做吗?如果有,任何人都可以解释我如何实现这一目标?
感谢您的时间。
我猜邮递员没有这样的功能来运行并发测试。
如果我是你,我会考虑Apache jMeter,它完全用于这种情况。
关于邮递员,唯一可以或多或少满足您需求的是 - 邮递员。 在那里你可以指定细节:
运行不会是并发的,只是连续的。
希望有所帮助。但要考虑jMeter(你会喜欢它)。
Postman不这样做但你可以在Bash中异步运行多个curl
请求:
curl url1 & curl url2 & curl url3 & ...
请记住在每个请求后添加一个&
,这意味着请求应作为异步作业运行。
但邮差可以为您的请求生成卷曲片段:https://learning.getpostman.com/docs/postman/sending_api_requests/generate_code_snippets/
我不知道这个问题是否仍然相关,但现在邮递员有这样的可能性。他们几个月前补充说。
您只需创建简单的.js文件并通过node.js运行它。它看起来像这样:
var path = require('path'),
async = require('async'), //https://www.npmjs.com/package/async
newman = require('newman'),
parametersForTestRun = {
collection: path.join(__dirname, 'postman_collection.json'), // your collection
environment: path.join(__dirname, 'postman_environment.json'), //your env
};
parallelCollectionRun = function(done) {
newman.run(parametersForTestRun, done);
};
// Runs the Postman sample collection thrice, in parallel.
async.parallel([
parallelCollectionRun,
parallelCollectionRun,
parallelCollectionRun
],
function(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.`);
});
});
然后运行这个.js文件(cmd中的'node fileName.js')。
更多细节here
并行运行文件夹中的所有Collection:
'use strict';
global.Promise = require('bluebird');
const path = require('path');
const newman = Promise.promisifyAll(require('newman'));
const fs = Promise.promisifyAll(require('fs'));
const environment = 'postman_environment.json';
const FOLDER = path.join(__dirname, 'Collections_Folder');
let files = fs.readdirSync(FOLDER);
files = files.map(file=> path.join(FOLDER, file))
console.log(files);
Promise.map(files, file => {
return newman.runAsync({
collection: file, // your collection
environment: path.join(__dirname, environment), //your env
reporters: ['cli']
});
}, {
concurrency: 2
});
在postman的集合中你不能同时进行异步请求,所以insted使用jmeter。
你可以使用Apache JMeter;它允许您添加多个线程并向其添加同步计时器
如果您只是在进行GET请求,而您需要在Chrome浏览器中使用其他简单解决方案,请安装“打开多个网址”扩展程序:
https://chrome.google.com/webstore/detail/open-multiple-urls/oifijhaokejakekmnjmphonojcfkpbbh?hl=en
我刚刚一次运行了1500个url,确实有点滞后google但它确实有效。
不确定人们是否还在寻找简单的解决方案,但您可以在Postman中运行“Collection Runner”的多个实例。只需创建一个带有一些请求的跑步者,然后多次单击“运行”按钮以显示多个实例。
对于更简单的GUI方法,请打开要在不同选项卡中运行的每个请求。然后,您可以通过单击运行转到每个选项卡。