Load Testing · Middle · Question 15 of 76

Where in a k6 script can you call open() to read a file?

Show the answer

Correct answer: Only in the init context, outside the default function

Explanation

File reads happen during init, when k6 prepares each VU. Calling open() in VU code throws an error.

Further reading

Problem with a question

Load Testing · Middle · question 15

Test yourself

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

Take this quiz