Goal 1: For a particular test case, I want to version test types (smoke, stress, …) independently
Goal 2: Pass a list of test types to execute via an env variable (or only one).
I implemented this using the “scenarios” feature, but I don’t think it’s good, because I can’t execute scenarios sequentially and there is nothing like “nested scenarios”, in which I can specify test type (parent scenarios) and the actually test scenarios for the test type.
if (__ENV.TEST_TYPE && __ENV.TEST_TYPE.includes("stress")) {
scenarios.stress = {
executor: 'constant-arrival-rate',
rate: 25,
timeUnit: '1s',
duration: '1m',
preAllocatedVUs: 50,
maxVUs: 100,
}
} else {
scenarios.smoke = {
vus: 1,
duration: '30s',
executor: 'constant-vus',
}
}
export let options = {
scenarios: scenarios,
thresholds: {
'http_req_duration{scenario:smoke}': ['p(99)<1500'],
'checks{scenario:smoke}': ['rate=1'],
'groupDuration{groupName:userFlowHomepage,scenario:smoke}': ['p(95) < 500'],
'groupDuration{groupName:findAllWelfareEntityByCategory,scenario:smoke}': ['p(95) < 300'],
'groupDuration{groupName:findWelfareEntity,scenario:smoke}': ['p(95) < 300'],
'http_req_duration{scenario:stress}': ['p(90)<1500'],
'checks{scenario:stress}': ['rate=0.9'],
'groupDuration{groupName:userFlowHomepage,scenario:stress}': ['p(90) < 3000'],
'groupDuration{groupName:findAllWelfareEntityByCategory,scenario:stress}': ['p(90) < 1500'],
'groupDuration{groupName:findWelfareEntity,scenario:stress}': ['p(90) < 1500'],
}}
As you can see, I have only one “thresholds” that discriminate via the scenario tag. With this arrangement, I can version all the scenarios in different js file (I can do that even for thresholds I guess).
Should I drop the scenario feature and use plain options and remove that “multiple tags selector” from thresholds?
What are the best practices? I couldn’t find anything about how I should structure my code for different types of tests.