Search code examples
javascriptk6

different options for different groups in k6


I have to rewrite .jmx file to k6. The migration tool did not work. In .jmx file there was a test plan with two thread-groups. Each thread group has different number of threads and loop counts.

Originally I wanted to do it like this

export default function () {
    group('JMX file test plan', () => {
        group('first thread group', () => {});
        group('second thread group', () => {});
    });

I thought to use options with configured vus and iterations.

export let options = {
    stages: [
        { vus: first-group-threads, iterations: first-group-loops },
        { vus: second-group-threads, iterations: second-group-loops }
    ],
} 

But as far as I understand it will execute all groups two times - with first stage parameters and second stage parameters.

Is there a way to execute each group with its own amount of vus and iterations? Or I have to create separate test files?


Solution

  • stages is not an equivalent to thread groups, and you can't use iterations in a stage.

    We're currently very actively working on supporting multiple executors, which would be the thing to support your use case exactly. You can follow the effort in PR #1007. Until it's merged in master, you can either build the branch yourself to use the new features (it's somewhat unstable and has a few known bugs), or use separate test files.