The JMeter HAR Importer plugin allows users to import HTTP Archive (HAR) files into Apache JMeter. The imported HAR files are then used to create JMeter sampler elements, facilitating the conversion of HAR files into JMeter test plans.
In the realm of web performance and load testing, the choice of tools and methods for capturing web traffic is critical. While the JMeter Recorder is a powerful tool within the JMeter ecosystem, we advocate for the use of HTTP Archive (HAR) files for several key reasons. Here, we outline the motivations behind choosing HAR files for capturing and analyzing web traffic, emphasizing portability and sharing, browser-agnostic capabilities, and ease of use.
HAR files are a standardized format for recording the intricate details of HTTP requests and responses. This standardization not only facilitates a deeper level of analysis but also ensures that HAR files can be effortlessly shared and utilized across diverse tools and platforms. Whether you're collaborating with team members who use different systems or integrating with various analysis tools, HAR files' compatibility significantly enhances collaborative efforts and streamlines the testing process.
One of the strongest suits of HAR files is their browser-agnostic nature. Given that they can be generated from the developer tools of most modern web browsers, HAR files capture web traffic in the user's actual environment, irrespective of the browser. This universality allows testers to replicate and analyze scenarios in a more accurate and realistic manner, ensuring that performance insights are as close to the end-user experience as possible.
Generating HAR files is remarkably straightforward, requiring no complex setup or configuration. Unlike the JMeter Recorder, which necessitates setting up proxy servers and specific recording settings, HAR files can be produced directly from the browser’s developer console. This ease of use is particularly beneficial in dynamic testing environments and when working with applications where modification access is restricted. By simplifying the capture process, HAR files enable testers to focus more on analysis and less on configuration, facilitating a more efficient testing workflow. Even your customers are able to generate their testing scenarios themselves without any additional knowledge about third party tools other than the browser itself.
Google Chrome offers a straightforward process for capturing HTTP Archive (HAR) files, which are invaluable for analyzing web traffic and diagnosing performance issues. This section provides a step-by-step guide on how to record and save HAR files directly from Chrome's Developer Tools, enabling you to gather comprehensive information about your web application's network activity.
- Navigate to the web page you wish to analyze.
- Open Chrome's Developer Tools by either:
- Right-clicking on the page and selecting
Inspect
, or - Using the keyboard shortcut
Ctrl+Shift+I
orF12
(Windows/Linux) orCmd+Opt+I
(Mac).
- Right-clicking on the page and selecting
- Go to the
Network
tab within the Developer Tools. Here, you'll see a record button (the red circle at the top-left corner of the tab). Ensure it's red to indicate recording is active. If it's grey, click it to start recording. - Check the
Preserve log
box to keep the network log across page loads. This is particularly useful for capturing traffic on pages that perform automatic redirections or for comprehensive analysis across multiple page interactions. - Refresh the webpage to start capturing the network traffic. It's essential to start with a clean state to ensure you capture all relevant network activity from the beginning of the page load.
- Once you have recorded the necessary network activity, right-click anywhere within the grid of network requests and select
Save all as HAR with content
. - Choose your desired location on your computer and save the file.
This HAR file now contains a detailed record of all network requests and responses made during the recording, along with timing information, headers, cookies, and other important data. This file can be used for further analysis, shared with team members for collaborative diagnostics, or imported into various tools that support HAR files for more in-depth performance evaluation.
To install the JMeter HAR Importer plugin, follow these steps:
- In JMeter install the Plugins Manager
- Choose the "HAR (HTTP Archive) Import" plugin
Once installed, follow these steps to import a HAR file into JMeter:
- Launch JMeter.
- Go to the "Tools" menu.
- Click on "Import HAR File".
- In the dialog box that appears, browse and select the HAR file you want to import.
- Click "Import".
- The plugin will automatically create HTTP Sampler requests for each entry in the HAR file, along with necessary configurations such as Header Managers and Cookie Managers.
Contributions to the JMeter HAR Importer plugin are welcome! If you encounter any bugs or have feature requests, please submit an issue on the GitHub repository.
This plugin is licensed under the MIT License. See the LICENSE file for details.
Execute run.bat
, maybe the path to your JMeter installation must be adapted to the right location -Djmeter.path=C:/scoop/apps/jmeter/current
.