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.
Join the DZone community and get the full member experience.Join For Free
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.
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.
Start Firefox with the new profile, and open about:config
Set xpinstall.signatures.required to false. This will allow us to install unsigned extensions.
Install Firebug from https://addons.mozilla.org/en-US/firefox/addon/firebug/
Install NetExport from http://www.softwareishard.com/blog/netexport/
Open about:config again
Configure the following options:
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.
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.
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.
Published at DZone with permission of Matthew Casperson, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.