Is posible to overwrite scenario.iterationInTest to 0 ? I need to start from ‘a’ again when the data set is over.
I tried something like scenario.iterationInTest = 0 , but didn’t give me results.
import exec from "k6/execution";
export const options = {
scenarios: {
session_endpoint: {
executor: "ramping-vus",
stages: [
{"duration": "0s", "target": 25},
{"duration": "20m", "target": 25},
{"duration": "0s", "target": 0}
]
},
},
};
export function setup() {
const name = [
"a",
"b",
"c",
"d",
"e",
"f",
"g",
"h",
"i",
"j",
"k",
"l",
"m",
"n",
"o",
"p",
"q",
"r",
"s",
"t",
"u",
"v",
"w",
"x",
"y",
"z",
];
console.log("setup() function is executed!");
return { name };
}
export default function (data) {
let index = exec.scenario.iterationInTest;
console.log(
`The index # is ${index}, The VU: ${__VU}, Iteration number: ${__ITER}, name is No. ${index} in ${data.name[index]}`
);
}