This article covers how BrowserMob can be used to test mobile websites by modifying the User-agent header and connection speed to match the desired device (iPhone, Android, etc.).
When deciding which version of the website to serve up, most mobile-enabled web applications rely on parsing the User-Agent http header. By modifying this value, BrowserMob Real Browser Users (RBUs) can be turned into “Mobile Browser Users”.

The first step is to determine what specific devices you want to simulate. Zytrax has put together a great compilation of the various different mobile browser user-agent strings here.
Once you’ve determined the User-Agent strings you want to test, the next step is to update the script to overwrite the standard User-Agent header in Firefox. This can be done via the following snippet:

Setting up your load tests with a blend of RBUs and VUs can be ideal but it does depend on the type of scripts you are running.  Does your script require the user to fill out a form or does the site use AJAX? For those instances, RBUs work best. If your script is about browsing the site as a read-only, VUs work just as well; plus saves you money. VUs is simply HTTP and may be harder to script (but 1/10th the price!).

Sometimes our customers wish to change the User-Agent for our browsers. By default it looks something like this:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7; BrowserMob RBU) Gecko/20100713 Firefox/3.6.7

Note the extra “BrowserMob RBU” reference there. You can use that to filter out third parties, such as analytics, ads, etc. However, you may want to actually change this value. To do so, you should use our advanced HTTP processing interceptor support:

var selenium = browserMob.openBrowser();
var c = browserMob.getActiveHttpClient();
 
c.addRequestInterceptor(function(req) {
  req.removeHeaders("User-Agent");
  req.addHeader("User-Agent", "Bananabot/1.0");
});

This will remove the standard User-Agent header and then add a new one with the value “Bananabot/1.0″.

When setting up monitoring jobs, there are often predictable time periods in which you want to change the behavior of a script or prevent it from running at all, without having to manually stop/start the monitoring job each time. For instance, you might want to prevent errors and alert emails during routine maintenance windows, or perhaps you’re only interested in site performance on weekdays during regular business hours. We’ve come up with solutions to a few common situations that will help jump start your scripts.

At BrowserMob we have two different levels of load testing support: one for Real Browser Users (RBUs) and one for Virtual Users (VUs). Often it’s not immediately clear what the difference is and why you’d use one over the other.

RBU Benefits

The high level difference is this: an 100 RBU test means that there will be 100 browsers in the cloud all loading your site and interacting with it, while a 100 VU test means that there will be 100 “threads” issuing HTTP GET and POST requests to your website, but not actually running a browser. This means that RBUs:

© 2012 The BrowserMob Blog Suffusion theme by Sayontan Sinha