Run Tests on 800+ Browser/OS Platforms with 1 CLI Command

Qunit Made Awesome on the Sauce Labs Cloud - Quick Tutorial

If you use QUnit, or want to use it, you probably want to run your QUnit tests on as many browsers and operating systems as possible. The whole idea of QUnit is that your Javascript unit tests run in a real browser, so you can see how the tests perform in a real life environment. BUT - how do you actually do that?

Sure, it’s easy to install Chrome, Firefox and Internet Explorer (say you’re on Windows), drag the QUnit HTML file into each of them, and see if the tests pass or fail. But what about:

  • All the different versions of each browser?
  • Safari (if you’re on a Windows machine) or IE (if you’re on a Mac)?
  • Testing the same browser on the other operating system? (could work differently)

To fully cover your bases, you need to install at least a few dozen browsers on 2 or 3 virtual machines. And then run your QUnit tests in each of them. This is pretty hard to do - even if it’s a one-time thing. But if you’re working TDD and have a build every few hours, it’s impossible!

Sauce Labs to the Rescue - QUnit Testing Made Awesome

Here’s where we come in. Sauce can help you run your QUnit tests on as many as 300 browser/OS combinations automatically in our cloud testing platform:

  • If you have an existing test runner, you can simply send us your QUnit tests through a convenient REST API, and continue working as usual, while leveraging the power of the Sauce cloud. See our REST API documentation.
  • If you're new to unit testing or use Grunt, our tutorial below will show you a quick setup, after which you'll run your tests on all those platforms with one CLI comand: $ grunt test - we'll then show you how to feed the results straight to your CI server.

And boom - we’ll run your tests on up to 300 Browser/OS combinations automatically in our cloud testing platform!

And - we’ll feed the results straight to your CI server (Travis, Jenkins, etc), or you can see them all in our cool web interface.

In Case We Haven’t Met..

Sorry, we forgot to introduce ourselves. Sauce Labs is all about making automated testing awesome. Our cloud testing platform has run over 90 million browser tests for thousands of organizations including Salesforce.com, Yelp, Firefox, and the BBC. Our battle-tested platform now enables running JS unit tests in many real browsers quickly and easily. We are now using the same proven platform to help you run JS unit tests in real browsers on a large scale.

Now that we know each other a bit better, let's get started! Read on for our quick tutorial.

About this QUnit Tutorial

If you have an existing test runner, - Yeti, Karma, Mocha Sauce, or Intern, this tutorial is not for you! If you're using a different test runner, head to our REST API documentation.

At the end of this tutorial, you'll have a CI system which can run YUI tests on a large scale on the Sauce cloud. To accomplish this, we'll use Grunt with the OSS plugin grunt-saucelabs) and Node.js.

If these are not the languages / technologies used in your project, don’t worry! You can use Java, Ruby, Python and many other languages to run your tests on the Sauce cloud.

Check out our wiki for the latest details of how to do JS unit testing. Our docs also have sample code to get started with Mocha .