Hi,
I’m trying to exclude one or several scenarios depending on an env parameter sent to my k6 script.
I have a bunch of scenarios testing API:s, now I have added a GUI scenario with k6-browser. I’d like to be able to run the script like this
k6 run –env INCL_GUI_TESTS=“false” myload.js and by that ignore the GUI-scenario in my “scenario list” and only run the API-scenarios. If I run the script without the env-parameter all scenarios should be executed.
Is there any way to do this?
I’ve checked out Advanced Examples | Grafana k6 documentation but it only describes how to run specific cenario/scenarios not how to exclude scenarios. Following that “guide” I have to list all the scenarios in the k6 calls env parameter that I would like to execute instead of just mention the few (or just like in my example a “switch” for GUI scenarios or not GUI scenarios) I’d like to exclude,
I’ve tried to manipulate the options.scenarios list by accessing the GUI-scenario setting its rate to 0, but of course a scenario cannot have 0 as rate so I get an error message regarding that. I also have tried to set the whole GUI-scenario to {} but as there are mandatory attributes to be set in a scenario I get errors.
Thank you very much for some help with this.
Best regards
Lightlore