No results for

Powered byAlgolia
⚠️ This is archived documentation for v0.33. Go to the latest version

group( name, fn )

suggest edits

Run code inside a group. Groups are used to organize results in a test.

ParameterTypeDescription
namestringName of the group.
fnfunctionGroup body - code to be executed in the group context.

Returns

TypeDescription
anyThe return value of fn.

Example

import { group } from 'k6';
export default function () {
group('visit product listing page', function () {
// ...
});
group('add several products to the shopping cart', function () {
// ...
});
group('visit login page', function () {
// ...
});
group('authenticate', function () {
// ...
});
group('checkout process', function () {
// ...
});
}
}

The above code will present the results separately depending on the group execution.

Learn more on Groups and Tags.