About a half year ago folks from Neustar demonstrated at Velocity Conference possibility of effective client-side performance testing using only free, open-source solutions. They introduced bundle of tools, such as Selenium and BrowserMob Proxy. The first one is intended to automate emulation of user interactions, the second one is a good for metric capturing. That was really inspiring presentation.

The greatest feature of their approach was the fact that all performance data are consolidated into single container – HTTP Archive (HAR). It makes further processing of test results more controlled and predictable due to strict format standardization.

However, there were no advanced tools for dealing with HAR files at that moment. HAR Viewer is wonderful but is not suitable for common testing workflow. ShowSlow is instead a perfect example of repository for automated performance measurement. Unfortunately handling of HAR files is not the strongest trait of it. So new project HAR Storage appeared.

Concept

Testing process is rather straightforward. All you need is to create Selenium script which describes common user actions. Then you arm your script with methods to control proxy server via its API. It not only means capturing and storing stream of HTTP requests but also customization of network characteristics (e.g., bandwidth and latency) and traffic filtering. The last point is extremely important for analysis of impact of third-party components on overall site performance.

Finally you can send HAR of each page or asynchronous event to local repository – HAR Storage. Actually, HAR Storage is a simple web application built on Pylons and MongoDB. It allows extracting detailed metrics from HAR files, storing test results and visualizing all gathered data.

Advantages

The key advantage is high flexibility. With BrowserMob Proxy use can test website in any modern browser that supports custom proxy settings. You can even deal with mobile browsers.

Selenium in turn makes it possible to simulate any sophisticated user scenario. Therefore you can analyze both speed of single page and performance of complex business transactions.

HAR Storage has cool features too. For instance, you can compare results of different tests. This is a great help for analysis of third-party party content or for investigation of relationship between site speed and network quality.

Performance Trends

At least with HAR Storage you can continuously track performance of your web site or application at any development phase.

Limitation

Nothing is perfect in this world. BrowserMob proxy runs outside the browser and on the one hand has minimal impact on its performance; on the other hand, internal browser events are inaccessible. Thus you can’t estimate performance of rendering or JavaScript parsing. Tools like dynaTrace AJAX Edition is more suitable for such tasks.

This approach may seem too complicated to some people. In fact it isn’t WebPagetest.org where you can simply put the URL and enjoy the result. But if you need real cross-browser testing, measurements over time and implementation of complex use cases – this method will work for you.

Conclusion

Web performance is still critical aspect, and performance testing is still a challenge. Frameworks based on Selenium, BrowserMob Proxy and HAR Storage may become an ultimate solution for many growing projects.

ABOUT THE AUTHOR

Pavel Paulau is analyst from Minsk, Belarus. Besides his daily work at EPAM Systems he tries to spread importance of performance as co-author of WebPerformance.ru blog.