GithubHelp home page GithubHelp logo

qytera-gmbh / jmeterharimporterplugin Goto Github PK

View Code? Open in Web Editor NEW
7.0 4.0 2.0 3.85 MB

A JMeter plugin that lets you select a HAR (HTTP Archive) file to import into JMeter

License: MIT License

Batchfile 0.30% Java 99.70%

jmeterharimporterplugin's Introduction

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.

Motivation

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.

Portability and Sharing

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.

Browser-Agnostic Approach

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.

Ease of Use

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.

Recording and Saving HAR Files in Google Chrome

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.

Step 1: Open Developer Tools

  1. Navigate to the web page you wish to analyze.
  2. Open Chrome's Developer Tools by either:
    • Right-clicking on the page and selecting Inspect, or
    • Using the keyboard shortcut Ctrl+Shift+I or F12 (Windows/Linux) or Cmd+Opt+I (Mac).

Step 2: Record Network Activity

  1. 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.
  2. 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.
  3. 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.

Step 3: Save the HAR File

  1. 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.
  2. 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.

Installation

To install the JMeter HAR Importer plugin, follow these steps:

  1. In JMeter install the Plugins Manager
  2. Choose the "HAR (HTTP Archive) Import" plugin

Usage

Once installed, follow these steps to import a HAR file into JMeter:

  1. Launch JMeter.
  2. Go to the "Tools" menu.
  3. Click on "Import HAR File".
  4. In the dialog box that appears, browse and select the HAR file you want to import.
  5. Click "Import".
  6. 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.

Contributing

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.

License

This plugin is licensed under the MIT License. See the LICENSE file for details.

Deploy and Test

Execute run.bat, maybe the path to your JMeter installation must be adapted to the right location -Djmeter.path=C:/scoop/apps/jmeter/current.

jmeterharimporterplugin's People

Contributors

besessener avatar csvtuda avatar

Stargazers

 avatar Joaquin Araujo  avatar Jorgen Evens avatar Bharath Chandra avatar Aliaksandr Belik avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

muyenzo nnlthings

jmeterharimporterplugin's Issues

java.lang.NoSuchMethodError

Using Windows 11 PC using Java version 8 Update 411 (build 1.80_411-b09)
With jmeter-har-import-plugin-v0.2.2.jar installed via JMeter (5.6.3) plugin manager
From Tools, Import HAR file, a file is selected but data is not imported to Jmeter

Theis error data is returned:

2024-06-18 14:22:58,766 ERROR o.a.j.JMeter: Uncaught exception in thread Thread[AWT-EventQueue-0,6,main]
java.lang.NoSuchMethodError: java.lang.String.formatted([Ljava/lang/Object;)Ljava/lang/String;
at de.qytera.jmeterharimporter.HARImporter.addNewThreadGroupWithSamplers(HARImporter.java:153) ~[jmeter-har-import-plugin-v0.2.2.jar:?]
at de.qytera.jmeterharimporter.HARImportDialog.lambda$new$4(HARImportDialog.java:228) ~[jmeter-har-import-plugin-v0.2.2.jar:?]
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) ~[?:1.8.0_411]
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) ~[?:1.8.0_411]
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) ~[?:1.8.0_411]
at javax.swing.DefaultButtonModel.setPressed(Unknown Source) ~[?:1.8.0_411]
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) ~[?:1.8.0_411]
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) ~[?:1.8.0_411]
at java.awt.Component.processMouseEvent(Unknown Source) ~[?:1.8.0_411]
at javax.swing.JComponent.processMouseEvent(Unknown Source) ~[?:1.8.0_411]
at java.awt.Component.processEvent(Unknown Source) ~[?:1.8.0_411]
at java.awt.Container.processEvent(Unknown Source) ~[?:1.8.0_411]
at java.awt.Component.dispatchEventImpl(Unknown Source) ~[?:1.8.0_411]
at java.awt.Container.dispatchEventImpl(Unknown Source) ~[?:1.8.0_411]
at java.awt.Component.dispatchEvent(Unknown Source) ~[?:1.8.0_411]
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) ~[?:1.8.0_411]
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) ~[?:1.8.0_411]
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) ~[?:1.8.0_411]
at java.awt.Container.dispatchEventImpl(Unknown Source) ~[?:1.8.0_411]
at java.awt.Window.dispatchEventImpl(Unknown Source) ~[?:1.8.0_411]
at java.awt.Component.dispatchEvent(Unknown Source) ~[?:1.8.0_411]
at java.awt.EventQueue.dispatchEventImpl(Unknown Source) ~[?:1.8.0_411]
at java.awt.EventQueue.access$500(Unknown Source) ~[?:1.8.0_411]
at java.awt.EventQueue$3.run(Unknown Source) ~[?:1.8.0_411]
at java.awt.EventQueue$3.run(Unknown Source) ~[?:1.8.0_411]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_411]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) ~[?:1.8.0_411]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) ~[?:1.8.0_411]
at java.awt.EventQueue$4.run(Unknown Source) ~[?:1.8.0_411]
at java.awt.EventQueue$4.run(Unknown Source) ~[?:1.8.0_411]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_411]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) ~[?:1.8.0_411]
at java.awt.EventQueue.dispatchEvent(Unknown Source) ~[?:1.8.0_411]
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) [?:1.8.0_411]
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) [?:1.8.0_411]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) [?:1.8.0_411]
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_411]
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) [?:1.8.0_411]
at java.awt.EventDispatchThread.run(Unknown Source) [?:1.8.0_411]

Cookies without expiry date cause `NullPointerException`

Describe the bug
When importing HAR files that have cookies without an expiry date set, the import fails with a NullPointerException.

To Reproduce

  1. Record a HAR file for a website which sets a session cookie
  2. Import the HAR file in JMeter
  3. See error

Expected behavior
I'd like to be able to import HARs with session cookies as well.

Screenshots
grafik

Desktop (please complete the following information):

  • Windows 10
  • Firefox 123.0

Additional context
Example HAR file:

{
  "log": {
    "version": "1.2",
    "creator": {
      "name": "Firefox",
      "version": "123.0"
    },
    "browser": {
      "name": "Firefox",
      "version": "123.0"
    },
    "pages": [
      {
        "id": "page_1",
        "pageTimings": {
          "onContentLoad": 782,
          "onLoad": 2008
        },
        "startedDateTime": "2024-02-24T18:34:32.815+01:00",
        "title": "https://github.com/Qytera-Gmbh/JMeterHARImporterPlugin"
      }
    ],
    "entries": [
	  {
        "startedDateTime": "2024-02-24T18:34:37.837+01:00",
        "request": {
          "bodySize": 0,
          "method": "GET",
          "url": "https://github.com/notifications/indicator",
          "httpVersion": "HTTP/2",
          "headers": [
            {
              "name": "Host",
              "value": "github.com"
            },
            {
              "name": "Accept",
              "value": "application/json"
            }
          ],
          "cookies": [
            {
              "name": "_octo",
              "value": "GH1.1.23456789.987654321"
            },
            {
              "name": "tz",
              "value": "Europe/Berlin"
            }
          ],
          "queryString": [],
          "headersSize": 1896
        },
        "response": {
          "status": 304,
          "statusText": "",
          "httpVersion": "HTTP/2",
          "headers": [
            {
              "name": "server",
              "value": "GitHub.com"
            },
            {
              "name": "date",
              "value": "Sat, 24 Feb 2024 17:34:38 GMT"
            }
          ],
          "cookies": [
            {
              "name": "has_recent_activity",
              "value": "1"
            }
          ],
          "content": {
            "mimeType": "application/json; charset=utf-8",
            "size": 17,
            "text": "{\"mode\":\"global\"}"
          },
          "redirectURL": "",
          "headersSize": 4250,
          "bodySize": 4287
        },
        "cache": {
          "afterRequest": null
        },
        "timings": {
          "blocked": 0,
          "dns": 0,
          "connect": 0,
          "ssl": 0,
          "send": 0,
          "wait": 116,
          "receive": 0
        },
        "time": 116,
        "_securityState": "secure",
        "serverIPAddress": "127.0.0.1",
        "connection": "443",
        "pageref": "page_1"
      }
    ]
  }
}

Loading/progress bar

Is your feature request related to a problem? Please describe.
When importing a really big HAR, there is no progress visible

Describe the solution you'd like
opening a progress bar after clicking on import would be helpful

Describe alternatives you've considered

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.