![Forrest logo](/images/logo.png)
k6:tldr:2491d
k6: Run load test locally with a given environment variable.
$ k6 run -e ${HOSTNAME=example-com} ${script-js}
try on your machine
The command you provided is used to run a load testing script using the k6 tool. Here's the breakdown of the command:
k6 run
: This is the main command to execute the k6 tool and run a load testing script.-e ${HOSTNAME=example-com}
: The-e
flag is used to pass environment variables to the script. In this case, you are passing an environment variable namedHOSTNAME
with a default value ofexample-com
. The syntax${HOSTNAME=example-com}
sets the value ofHOSTNAME
toexample-com
only if it is not already set.${script-js}
: This is the file path or name of the load testing script written in JavaScript that you want to execute.
So, when you run this command, k6 will execute the load testing script specified by ${script-js}
and any environment variables that you've set, such as HOSTNAME
with the default value of example-com
, will be accessible within the script.
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.