Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Cloud testing

Vincent Voyer edited this page Mar 2, 2015 · 14 revisions

Once you have your tests running locally in your browser, it is time to run them across a range of other browsers and systems. This way you can be sure your code works in the browsers you wish to support.

For our cloud testing we will we will leverage saucelabs to run our same tests in the browser.

1. get a saucelabs account

If you already have a saucelabs account you can skip this step.

Open source projects can use the awesome free for open source version of saucelabs. If you want to use saucelabs for company projects, please consider getting one of their paid accounts.

2. educate zuul

To run your tests in the cloud, zuul needs to know your saucelabs credentials (username and api key). Obviously you don't want to expose these in your repo so zuul has a better way: a config file in your home directory.

Open ~/.zuulrc with your favorite editor and make it look like the following:

sauce_username: my_awesome_username
sauce_key: 550e8400-e29b-41d4-a716-446655440000

Obviously replace with your name and key from your account. See the zuulrc wiki page for more more details about this file.

3. select browsers to test

Back in your project directory (not your home directory where we put the zuulrc file), add the following file .zuul.yml

ui: mocha-qunit
browsers:
  - name: chrome
    version: 27..latest
  - name: ie
    version: latest
  - name: iphone
    version: 6.1

This will run our tests on chrome, iphone, and internet explore browsers. Take note of how versions can be specified. You can specify a specific number (safari example), use the special keyword latest to test the latest version (zuul will auto detect it), or specify a range using .. to test all available versions including the range bounds.

For chrome and firefox, you can also use version: 39..dev to even test stable, beta and dev channels.

An available list of browsers can be found here https://saucelabs.com/docs/platforms and the JSON zuul reads is here: https://saucelabs.com/rest/v1/info/browsers/webdriver. You can also list the browsers directly on the command line with the --list-available-browsers flag.

See the zuul.yml page for other valid fields and examples.

See the available browsers by using:

zuul --list-available-browsers

4. run zuul

We are now ready to run our tests in the cloud. Simply run zuul without the --local flag.

zuul -- test

Zuul will create a server, establish a tunnel so saucelabs can find our tests, and then ask saucelabs to run your tests. You can open your saucelabs dashboard to see tests being run and their results. Zuul will exit when all tests are done.

Done

Once you are happy with your saucelabs tests (all passing I hope), you are ready to hook up the last piece: travis-ci.

Clone this wiki locally