How to properly test and run multiple browser separate tests in a single scenario?

Hi @moonbridge,

Can you give us a bit more context as to what exactly you are trying to test? We understand that it’s a website, but what are you trying to assert when the tests run?

Scenarios are a good way to emulate/model the traffic and see how your web services (or website) handles that load. shared-iterations will share the total number of iterations between all the VUs. So if you had 10 VUs and 100 iterations then each VU (which run in parallel) will run the test until a total of 100 iterations of the test completes.

Here are a couple of ways in which you could run the tests sequentially:

  1. Now that k6 supports async and await keywords, you could make each of the tests async and in the main tests function await on each of them. e.g.
    export async function tests() {
      await test1();
      await test2();
      await test3();
      await test4();
      await test5();
    }
    
    async function test1() {
      ... // test code
    }
    
    async function test2() {
      ... // test code
    }
    
    ... // Other tests
    
  2. Check out this post on running tests sequentially using scenarios.

Cheers,
Ankur

1 Like