Introduction to HAR File

An HTTP Archive or HAR file format contains flexible and extensible codes. A HAR file contains much ready-made information that may be directly used to infer information that may be used by the Gatling to get a graphical representation after simulation.

The HAR file is also a way of creating scenarios instead of a Scala script, as we have seen and discussed in our early topics.

The use of the HAR file as a scenario is not that popular as compared to the use of Scala Script, as in the case of using the Scala script, the user needs not to think about the intermediate file which is .scala in our case. The user may simply keep on simulating the test cases and get the .html file and get the graphical output.

The HAR file can be expected to have the following details inside it:

  • How much time has been taken to fetch the DNS information
  • How much time it requires for any object to be requested.
  • How much it has taken to connect to the server
  • How much time does it take to get the assets transferred from the server to the requested object

It may be mentioned that extracting the understandable data from the HAR file is not easy directly, as it is stored as JSON code in very low-level data. But trying to analyze the data, with a certain time, a person may easily get used to it.

A HAR file can be very useful to get the core parameters that are required to analyze the performance of a web application. This has to be mentioned that this file already contains the parameters in a ready-made way, so it becomes easy for the Gatling Process to acquire data out of it.

Previously, we have seen how we created scenarios using the Gatling Recorder. It was a single software process and no more intermediate files were needed. The .scala file was created directed by the Gatling software itself by analyzing the live request inside the website.

Here, we will see how the requests and the total scenario is recorded by our browser itself and how we can get the ready-made .har file from our browser.

Generate and Convert HAR file

Below we will list several steps for getting the HAR file from our browser. Here, in our study we will use Mozilla Firefox as our testing browser, you may use any other browser, as almost all have the option for inspection of elements inside the browser itself.

How to see the HTTP Archive:

For this, all you have to do is to go to the browser where you have already set the network proxy manual. And port 8000, host localhost , and subnet mask is already set. For all the LAN settings, you may refer to our section creating a test scenario.

Now go to the browser and right-click and select the inspect element option.

After clicking on inspect element, you should see the following screen:

After that browse the website you want to. In this example, we have considered, you may choose any. When the page is being loaded, we should be able to see the logs being generated.


You may choose to save your harfile inside any folder you want. Now it is time to convert the har file into scala script.

Converting the HAR into Scala:

For this you have to start the Gatling recorder, then open file recorder.bat, and you should see the GUI of the Gatling recorder popping up on the screen. There set your output folder, class name set as any_name, and select the har file you saved just now from the browser.

Select Recorder Mode as HAR Converter. It is shown on the screen below:

Now the start button can be tapped to start converting the HAR into the required scala script. Now, this script can be used to perform simulations as discussed earlier.

Advantages of HAR file

From Gatling's simulation's point of view, there are some benefits of using the HAR file.

  • The HAR file indirectly exported by the browser itself, and so there is no modification of any intermediate software between.
  • The file contains almost all the ready-made information about the web pages and so it becomes easier for the Gatling, to process them.
  • Decreases the load of the Gatling Recorder.
  • As exported in JSON code, it may be used by other software to produce different file format outputs, instead of scala only.
0 results
Comment / Suggestion Section
Point our Mistakes and Post Your Suggestions