π± 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ΒΆ
- Prepare your scenario by thinking through the steps you want to execute.
- Open Chrome in either Guest or Incognito mode (itβs important to have no cookies prior to starting).
- Open the Developer Tools.
- Open the Network panel.
- Select Disable cache and Preserve log.
- Clear the existing log by clicking the Clear π« button.
- Ensure recording is enabled: the Record button should be red π΄ (click it to toggle).
- Navigate to your target site by entering the URL in the address bar, like
https://www.zalando.de
. - 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:
- End recording by clicking the Record π΄ button.
- Right-click on any of the file names listed in the bottom pane of the Network panel.
- Select Save as HAR with content.
- 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.