Load Testing · Junior · Question 57 of 75

How do you read an environment variable in a k6 script?

Show the answer

Correct answer: __ENV.BASE_URL

Explanation

k6 doesn't run on Node.js, so there is no process. Variables come from the system or -e BASE_URL=... and are read via __ENV.

Further reading

Problem with a question

Load Testing · Junior · question 57

Test yourself

Take the Load Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz