Load Testing · Junior · Question 16 of 75

In a k6 script, what does the exported default function contain?

import http from 'k6/http';

export default function () {
  http.get('https://test.k6.io');
}
Show the answer

Correct answer: The code each virtual user runs on every iteration

Explanation

The default function is the VU code. Each VU runs it in a loop for the duration of the test. One-time preparation goes into setup().

Further reading

Problem with a question

Load Testing · Junior · question 16

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