Is there any possibility to load a json data file from command line rather than using the below in testscript.js file ?
const data = JSON.parse(open("./data.json"));
Is there any possibility to load a json data file from command line rather than using the below in testscript.js file ?
const data = JSON.parse(open("./data.json"));
You can pass the filename as an environment variable like this k6 run --env MY_CONFIG_FILE=production.json
, and then in your script you can have something like this:
const data = JSON.parse(open(__ENV.MY_CONFIG_FILE));
thanks, it sounds to be a working solution.