How to run Vus parallel for all scenerio?

When two separate Vus start working, I want them both to run in parallel by making consecutive requests to all endpoints. So you can think like this. There are two separate users and they must both complete a job from start to finish in a separate branch at the same time. The endpoints that complete my work process are as below. My purpose here is to set an option or executer that sends requests to all endpoints in two branches at the same time. How do I do that? Because when it is as below code, two different users work in parallel at the first endpoint, I m taking successful for one user and an error for the other user.

export const options = {
    scenarios: {
        CreatePicking: {
            executor: 'shared-iterations',
            exec: 'CreatePicking',
            vus: 2,
            iterations: 2
        },
    }
}

export function CreatePicking(data) {

    let createdIsCompleted = false;
  
    let generateTokenHeader = {
        headers: {
            'Authorization': `Bearer ${data.access_token}`,
            'content-type': 'application/json',
        },
    };

    describe('Continue pick test', (t) => {
            let continueExistRes = http.post(requestUrlAPI + 'PickingProcessTest', JSON.stringify({
                trolleyLabel:'PCK-TRL-L-0' + (vu.idInTest-1)
            }), generateTokenHeader
            )
            t.expect(continueExistRes.status).toEqual(200);
            sleep(1)
    });

    describe('check test', (t) => {
        while (createdIsCompleted == false) {
            let checkCellRes = http.post(requestUrlAPI + 'PickingProcess.checkCell', JSON.stringify({
                cellLabel: `${cellLabel}`,
                pickingReferenceNumber: `${pickingProcessReferenceNumber}`,
                allocatedItemId: `${allocatedItemId}`,
            }), generateTokenHeader)
            console.log("checkCellControlRes", checkCellRes.body)
            t.expect(checkCellRes.status).toEqual(204);
        }
        sleep(1)
    });

@imiric @mostafa @fernandoveras @inanc @olegbespalov @ned do u have an idea?

Hey @Yusuf,

Have you read this article?

1 Like