Hello,
i have to test my performance api , can some on explain to me how to hit a single endpoint at the same time ?
Hello,
i have to test my performance api , can some on explain to me how to hit a single endpoint at the same time ?
Not sure the tool is design for load testing, or if this will help you. But it is a good example of spawning lots of calls from a single postman API call.
//pre call code
function makelotsofrequests(runnumber) {
let url= 'http://foo.com/api/something?x=runnumber'
pm.sendRequest(url, function (error, response) {
const data = response.json();
pm.environment.set(runnumber, JSON.stringify(data));
});
let max = 100;
for (let i=1; i< max; i++) {
makelotsofrequests(i);
}
//post call code
function processdatafromlotsofrequests(runnumber) {
xdata = JSON.parse(pm.environment.get(runnumber));
// console.log('run ' + i + ' report some values from responsebody ' + xdata.message ); // set xdata.message to what is in your responses
pm.environment.unset(runnumber);
});
let max = 100;
for (let i=1; i< max; i++) {
processdatafromlotsofrequests(i);
}
As mentioned earlier, Postman isn’t really a load-testing or concurrency testing tool, buy you should spend some time looking at this node module: