No results for

Powered byAlgolia

Recording a session

Load tests should be realistic. One way to create a realistic test is to use a recording of a user session. You can then use this recording to model the logic of your test.

k6 provides two tools that can directly convert a recording into k6 script:

Record instead of scripting

The recording process has three steps:

  1. Record a user or API session.
  2. Convert the recorded session into a test.
  3. Run the test.

Recordings show the sequence of the session's requests and parameters, helping testers quickly build complex chains of requests. For this reason, testers commonly use recordings while testing complex scenarios on websites or mobile applications.

Suppose you have to create a performance test that simulates a user journey with dozens or hundreds of requests. In such a case, the recording lets you avoid writing the test from scratch.

Be sure to record realistically

Before you record your session, consider the following dos and don'ts.

It's a good idea to:

  • Browse as a user would
  • Take natural pauses that users would take to consume page content
  • Focus on the most common use cases, rather than all the possible use cases
  • Take note of pages where forms/logins occur. You will likely need to complete some scripting.

You probably do not want to:

  • Visit every page in one journey
  • Click every possible option
  • Navigate as fast as you can
  • Navigate out of your actual site or application