🌱 Creating HAR files¢

HAR files are JSON files storing everything needed to β€œreplay” a web browsing session from the server’s point of view. They contain all web requests made by a web browser, and the corresponding responses from the server.

For this reason, we often call a HAR file a scenario: like the scenario of a play or movie, it describes what is supposed to happen. Following a scenario is experiencing the story it tells.

Transformer converts these HAR files into a program that load tests the visited web sites by replaying the recorded scenarios at large scale.

Anyone can easily create HAR files using a web browser. Here, we use Chrome, but the steps for Firefox are extremely similar (and other browsers probably follow the same pattern).

Record a scenarioΒΆ

  1. Prepare your scenario by thinking through the steps you want to execute.
  2. Open Chrome in either Guest or Incognito mode (it’s important to have no cookies prior to starting).
  3. Open the Developer Tools.
  4. Open the Network panel.
  5. Select Disable cache and Preserve log.
  6. Clear the existing log by clicking the Clear 🚫 button.
  7. Ensure recording is enabled: the Record button should be red πŸ”΄ (click it to toggle).
  8. Navigate to your target site by entering the URL in the address bar, like https://www.zalando.de.
  9. Perform your scenario by clicking through the pages, filling in forms, clicking buttons, etc.

Note

After each click/action, and before the next one, we recommend that you wait until the network panel stops showing activity. This ensures that all requests are properly recorded.

Save your scenario as HARΒΆ

Once you have finished performing your scenario:

  1. End recording by clicking the Record πŸ”΄ button.
  2. Right-click on any of the file names listed in the bottom pane of the Network panel.
  3. Select Save as HAR with content.
  4. Save the file on your machine.

Note

You can view the details of a HAR file by simply drag-and-dropping it into the Chrome Developer Tools Network panel.

See also

βš– Specifying Weights
Define how often should a particular scenario be executed compared to the others.
πŸ‘‘ Hierarchical Scenarios
Organize your groups of scenarios.
πŸ™ˆπŸ™‰ Ignoring specific URLs
Avoid including irrelevant URLs from your HAR files into the final locustfile.