Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Capture Network Transactions With Iridium

DZone's Guide to

How to Capture Network Transactions With Iridium

Learn how to use Iridium to track network transactions as you run your integration tests with the ability to track website performance over time.

Free Resource

Although Iridium is not designed to stress test your web applications, sometimes it is nice to be able to collect objective performance measurements from your web sites using a consistent set of interactions. With Iridium, Firefox, FireBug and the NetExport plugin, it is possible to capture the network transactions that take place during a test.

To get started, we need to configure a special Firefox profile that contains the extensions that we will make use of to capture the network transactions that take place.

  1. Create a local Firefox profile called selenium using the instructions at https://support.mozilla.org/en-US/kb/profile-manager-create-and-remove-firefox-profiles.

  2. Start Firefox with the new profile, and open about:config

  3. Set xpinstall.signatures.required to false. This will allow us to install unsigned extensions.

  4. Install Firebug from https://addons.mozilla.org/en-US/firefox/addon/firebug/

  5. Install NetExport from http://www.softwareishard.com/blog/netexport/

  6. Open about:config again

  7. Configure the following options:

    • extensions.firebug.console.enableSites: true
    • extensions.firebug.script.enableSites: true
    • extensions.firebug.net.enableSites: true
    • extensions.firebug.previousPlacement: 1
    • extensions.firebug.allPagesActivation: on
    • extensions.firebug.netexport.alwaysEnableAutoExport: true
    • extensions.firebug.netexport.defaultLogDir: <your output directory>

What we have done is installed some Firefox extensions that we can use to track the network transactions that take place during a test script execution, and configured the extensions to open and begin recording once the browser is opened.

The next step is to configure Iridium to use this custom Firefox profile. We do this via the webdriver.firefox.profile system property:

<property name="jnlp.webdriver.firefox.profile" value="selenium" />

You can run an example Web Start application by right clicking on this link, saving the file to the local disk, and running it.

When the script is run, you’ll see that Firefox has automatically opened the Firebug extension at the bottom of the page.

Screen Shot 2016-07-12 at 6.08.13 PM.png

Once the test is complete, a HAR file will be saved in the location that you set against the extensions.firebug.netexport.defaultLogDir Firefox configuration option. This file contains the details of the network transactions that took place during the test script execution.

There is a neat service at http://www.softwareishard.com/har/viewer/ that allows you to visualize these transations, much like you would in the developer tools provided with most browsers these days. This tool shows you download sizes, URLs, times and how the interactions contributed to the overall download time of a web page.

Screen Shot 2016-07-12 at 6.12.03 PM.png

HAR files are a great way to track what was downloaded, how big it was, and how long it took, and for comparing those results to future runs to see how the performance and network load of your web sites has changed over time.

Topics:
extension ,profile ,firebug ,transactions ,script ,firefox ,extensions ,performance ,application ,web

Published at DZone with permission of Matthew Casperson, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}