Hi all,
I’m new at k6 and TypeScripts, but I have experiences with different load test tools. I’m interested in the possibility to use browser and API calls within one test run. That’s why I created two scenarios - one “UI” with browser and the “API” for http requests.
My situation is, that often the run interrupts before the test end. And sometimes the run is OK. I didn’t changed the script between the runs. I would know what I can check to make the script stable.
Here are my run results:
fail:
running (00m22.1s), 00/13 VUs, 0 complete and 13 interrupted iterations
API_BCU02 ✗ [=>------------------------------------] 10/10 VUs 0m22.0s/6m43.0s
UI_BCU02 ✗ [==>-----------------------------------] 3 VUs 0m22.0s/3m40s
running (03m04.2s), 00/13 VUs, 13 complete and 13 interrupted iterations
API_BCU02 ✗ [================>---------------------] 10/10 VUs 3m04.0s/6m43.0s
UI_BCU02 ✗ [==============================>-------] 3 VUs 3m04.0s/3m40s
OK:
running (08m24.1s), 00/13 VUs, 37 complete and 0 interrupted iterations
API_BCU02 ✓ [======================================] 00/10 VUs 6m43s
UI_BCU02 ✓ [======================================] 3 VUs 3m40s
Here are my settings:
config-file:
…
“PACING_BROWSER_BCU02”: “125”,
“PACING_HTTP_BCU02”: “125”,
“TEST_DURATION”: “220”,
“VUS_UI”: “3”,
“VUS_API”: “10”,
…
test-script (TS):
…
export const options: Options = {
scenarios: {
UI_BCU02: {
executor: ‘constant-vus’,
options: {
browser: {
type: “chromium”,
headless: true
}
},
vus: config.VUS_UI,
duration: `${ config.TEST_DURATION }s`,
gracefulStop: `${ config.PACING_BROWSER_BCU02 * 2 }s`,
tags: { type: “ui” },
exec: “UI_BCU02”
},
API_BCU02: {
executor: “ramping-vus”,
startVUs: 0,
stages: [
{ duration: `${ config.VUS_API * 2 }s`, target: config.VUS_API }, //ramp up load
{ duration: `${ config.TEST_DURATION }s`, target: config.VUS_API }, //keep load
{ duration: `${ ( Math.round( config.PACING_HTTP_BCU02 * 1.3 ) ) }s`, target: 0 } //ramp down load
],
gracefulRampDown: `${ 2 * config.PACING_HTTP_BCU02 }s`,
gracefulStop: `${ 2 * config.PACING_HTTP_BCU02 }s`,
tags: { type: “api” },
exec: “API_BCU02”
}
}
…
Here I have the non-variable version:
UI_BCU02: {
executor: ‘constant-vus’,
options: {
browser: {
type: “chromium”,
headless: true
}
},
vus: 3,
duration: “220s”,
gracefulStop: “250s”,
tags: { type: “ui” },
exec: “UI_BCU02”
},
API_BCU02: {
executor: "ramping-vus",
startVUs: 0,
stages: \[
{ duration: "20s", target: 10 }, //ramp up load
{ duration: "220s", target: 10 }, //keep load
{ duration: "163s", target: 0 } //ramp down load
\],
gracefulRampDown: "250s", // maybe it's optional
gracefulStop: "250s", // !!! this is a must (default = 30s)
tags: { type: "api" },
exec: "API_BCU02"
}
Thank you in advance, Niko.