Jasmine JS

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

Jasmine Made Awesome on the Sauce Labs Cloud - Quick Tutorial

If you’re a current user of the Jasmine JS framework, or are planning to use it, you’re probably interested in running Jasmine tests on as many browsers as possible. A typical use case for Jasmine is to run your JS unit tests in a real browser, so you can see how the tests perform in a real life environment. BUT - this can get quite complex.

Sure, it’s easy to install Firefox, Internet Explorer and Chrome (if you’re on Windows), open the Jasmine SpecRunner HTML file in each of them, and see the test results. But what about:

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

To make sure you’re truly covering the platforms users are running, you need to install at least 20 or 30 browsers on 2 or 3 virtual machines (this will give you only basic coverage). And then run Jasmine’s SpecRunner.html in each of them. Even if you do this on an ad-hoc basis, it’ll be pretty hard. But if you have a build every few hours, it’s downright impossible!

Sauce Labs to the rescue - Jasmine JS testing made awesome

Here’s where we come in. Sauce can help you run your Jasmine tests on our deep selection of Browser/OS combinations automatically in our cloud testing platform:

  • If you have an existing test runner, you can simply send us your 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 Jasmine tests on all those platforms with one CLI command: $ grunt test - we’ll then show you how to feed the results straight to your CI server.

Your first time here?

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.

Keep in mind: Our cloud service isn’t free. We do have a 14-day free trial that gives you access to testing minutes and concurrent sessions.

And, - we’re free for open source projects!

Now that we’ve met, let’s run! Read on for our quick tutorial.

About this Jasmine JS tutorial

If you have an existing test runner, this tutorial is not for you! Visit these links to use Sauce with Yeti, Karma, Mocha Sauce, or Intern, or for any other test runner, head on to our REST API documentation.

If you are new to unit testing or already use Grunt, read on!

In this tutorial we use Grunt (with the plugin grunt-saucelabs - don’t worry, it’s open source) and Node.js. The end goal is to set up a complete CI system which can run Jasmine tests on the Sauce Cloud at large scale.

Are these not the technologies or languages used in your code? No sweat, you can use Python, Java, Ruby, and many other languages to test on Sauce.

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 Jasmine and Grunt.

We hope you enjoyed our tutorial and are ready to run your Jasmine JS tests at scale with Sauce Labs! Want more? Just sign up for a free trial of Sauce and get testing!