How to code that a variable to be different at the same time as the number of users?

When the script run, 2 VUs running parellel. My problem is testLabel should be unique for every user when I use post method. For example,testLabel should be PCK-L-01 for one user, at the same time testLabel should be PCK-L-02 for other user. Maybe I can increase the VUs number until 5.I tried to combine trolley and counter in my example(e.g. PCK-L-01). The main problem is that the value of trolleys should be different at the same time as the number of users. If any alternative ways are available, I will be happy

My options like below;

export const options = {
    scenarios: {
        CreatePicking: {
            executor: 'per-vu-iterations',
            exec: 'CreatePicking',
            vus: 2,
            iterations: 1

My export fuction code below;

export function CreatePicking(data) {

    let trolley= "PCK-L-0"      
    let counter=0;

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

    describe('Continue picking', (t) => {
            let continueIfExistRes = + 'Picking.continue', JSON.stringify({
            }), generateTokenHeader


@codebien @Tom @SrPerf do u have an idea?

Hey @Yusuf
For your situation I would concat the VirtualUser number or identificator to the lable you are trying to create.
Use at the beginning:

import { vu } from 'k6/execution';

Then inside of your code, each element you are trying to label concatenate the vu number to have a unique param.

var Label = 'LabelPCK-L-' + vu.idInTest;

That should give you an unique LAbel per Virtual User.
If you want to make it even more unique you can also add the iteration number after the vu number. iterationInInstance or iterationInScenario

For more info:

Hope that helps!

@Leandro-SrPerf thanks for solution. The numbers should increase 1,2,3,4,5 . Could this solution increase like this ?

Hey @Yusuf !
In a way, yes.
We must keep in mind the number of virtual users and the parallel iterations for each.
Let’s do an example. Suppose we create something for 3 users to iterate 10 times.

import http from 'k6/http';
import exec from 'k6/execution'

export const options = {
    scenarios: {
      Nombre: {
          executor: 'per-vu-iterations',
          vus: 3,
          iterations: 5,
          maxDuration: '1h30m',

export default function () {
  console.log('Unique Virtual User:'+ + '     Iteration:' +;

That will give you an incremental number per user.

Another option I can think of for an incremental number per user is just to add 1 to a variable.

Hope that helps. :slight_smile: