Simulating 100 users using Pre-Request and Tests

My question:
So i am trying to setup something is postman so that I can simulate new chat being created while hitting the api

Details (like screenshots):


It not working I get status 200 put not simulating on FE. What I am doing wrong here

@Kevin Any info you could share?

@sean.keegan - Any ideas

@bpricilla anything you could share ??

@kkalpana55 @rolerik - FYI

@michaelderekjones - If you can provide any info.

Your number environment variable appears to be an array, when it looks like it should just be a single entry.

What you probably need is two variables. One for the array, and one for the current number.

Personally I would call one “numberArray” and the other “currentNumber” to avoid all doubt when looking at the code.

Your pre-request script would retrieve the array and set the current number using the JavaScript array.shift() function to reduce the array and set the current number before saving both as environment variables.

Your tests tab would also retrieve the array, and then use setNextRequest if the array length is more than zero.

Please remember to stringify the object\array before saving it to the collectionVariable, and JSON.parse it when retrieving.

Lastly, you need to run this through the collection runner, otherwise setNextRequest will not be triggered. It only works through the runner.

Please note usage limits on the runner. (Hopefully you are on the enterprise license, otherwise you will run out of runs very quickly).

The following is an example using setNextRequest and array.shift().
Hopefully it shows the logic.

Pre-Request script

var array = JSON.parse(pm.collectionVariables.get("resources"));

if(array.length === 0){
    array = [

pm.test("pre-req array is not empty", () => {

var currentResource = array.shift();

pm.collectionVariables.set("resources", JSON.stringify(array));

Tests tab

var array = JSON.parse(pm.collectionVariables.get("resources"));

var expectedResponse = pm.collectionVariables.get("id");
var actualResponse = pm.response.json().args.test;

pm.test(`tests-tab id = ${expectedResponse}`, () => {

if (array.length > 0){

} else {

pre request code :
var array = [
“what is RAM?”,
“what is adobe?”

pm.test(“pre-req array is not empty”, () => {

var currentResource = array.shift();

pm.collectionVariables.set(“resources”, JSON.stringify(array));
test script :
var array = JSON.parse(pm.collectionVariables.get(“resources”));
var expectedResponse = pm.collectionVariables.get(“id”);

// If there are elements left in the array, set up the next iteration
if (array.length > 0) {
// Shift the current array element from the array
var currentElement = array.shift();

// Compare the current element with the expectedResponse
pm.test(`Compare element: ${currentElement}`, () => {

// Set the current element as the prompt value in the FormData body
pm.request.body.formdata.add({ key: 'prompt', value: currentElement });

// Update the collection variable "resources" with the modified array
pm.collectionVariables.set("resources", JSON.stringify(array));


} else {

response :
pre-req array is not empty
Compare element: what is adobe? | AssertionError: expected ‘what is adobe?’ to deeply equal ‘what is RAM?’
still second element is fetched

I have to define in this value according to the code