How to run a single test once?

For testing purposes I want to run a single test function only once with k6 (to see if the test is properly set up). I do not know how long this single test runs.

How to do that with k6?

By default, unless you specify any of the options to configure number of users, stages, etc., k6 will execute one iteration of your test script using one virtual user.

You could also explicitly define those options:

export let options = {
  vus: 1,
  iterations: 1
};
3 Likes

Thanks, that works fine.