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');
}- 1The code that runs once before the whole test starts
- 2The settings for the number of users and the duration
- 3The code each virtual user runs on every iteration
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().