Skip to content
August 26, 2013 / selenium34

Why are we using BrowserMob Proxy?

After reading the last post, you may be thinking, why are they running a proxy with PhantomJS. There are many reasons for us to run our tests through a proxy server. BrowserMob Proxy gives us many options on customizing our test runs, some of the features worth looking into:

  • We can artificially slow down our runs to mimic dial up connection users or those who might be behind a hotel connection where speeds are limited.
  • We can use a white or black list to increase test run speeds.
  • We can set custom header values

We created a custom reporter to upload a har file, and then upload it to a project called Har Storage. We actually utilize the same AWS instance we setup PhantomJS on. We now have an easy way to generate some performance trends over time. We setup Page Speed to be run upon upload of the files, so we can actually see the scores we receive for each of our runs. One downside with this project, is it currently only displays the speed — although it is open source, you could add in code to display the results. You could also add in results for YSlow, as it also has a command line option. Below is an example chart generated after loading a page a few times.

Performance Trends over multiple Test RunsYou can also aggregate these into reports depicting various metrics. You can obtain information on the Average, Median, 90th percentile, minimum, and maximum times. This is especially beneficial if you have a multitude of runs over time. Below is an example of the aggregation feature:

Some things we could ultimately do with these combinations:

  • Setup a browser in each of the availability zones and gather metrics for each area of the country / globe
  • Utilize multiple proxies, whereby we limit bandwidth to allow us to run tests of varying speeds to mimic the connection speed of various users.
  • Test builds to ensure our Page Speed score isn’t decreasing between builds
  • Proxy different browsers to test affects of different browsers on page loads.

All in all, it’s been said many times before, if you’re utilizing WebDriver, you should be proxying your tests at this point. You can also run the proxy in embedded mode, don’t push it off because you’re not using AWS or don’t want to work with the REST API!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: