Automated JavaScript Testing with BrowserSwarm

Craig Buckler

There are developers who write code which is so perfect they never need test it. They’re usually the same ones who refuse to add comments, use source control or discuss their techniques with fellow colleagues. For the rest of us, testing is essential — but mind-numbingly tedious. Web developers also have the onerous task of deploying their code in a multitude of web browsers on different PCs and OSs.

Fortunately, BrowserSwarm is a new cloud-based system which makes JavaScript testing a little more bearable. The steps are reassuringly simple:

  1. Sign-up for an account at BrowserSwarm.
  2. Add your project. You can automatically link with GitHub or add your own repositories.
  3. Configure your unit tests using tools such as QUnit.
  4. View or download the test results generated for multiple browsers; typically a few recent editions of Firefox, Chrome, Safari and Opera and IE6 to IE10. Those with a SauceLabs account can also test a wider variety of desktop, tablet and mobile browsers on other devices.

An example set of test results for Backbone.js:

BrowserSwarm test

A more detailed error report can be viewed for any test job:

BrowserSwarm test details

You can find tests for other popular libraries including jQuery, jQuery UI, Dojo, MooTools, Prototype and more.

The service is fast, easy to use and removes much of the testing burden we encounter every day. BrowserSwarm is also an open source project; you can contribute other repositories, frameworks, unit tests or any other feature you desire.

Oh yes, I neglected to mention that BrowserSwarm is free!

Who’s responsible for this amazing open source tool? Microsoft. Yes, you read that correctly. The service is a collaboration between Microsoft, AppendTo and SauceLabs to compliment the browser testing facilities already available at modern.IE.

BrowserSwarm is currently in beta and possibly requires a little more help and documentation, but it’s set to make our development lives considerably easier.