Skip to content

Running tests on Sauce Labs locally

Xiaohan Zhang edited this page Feb 2, 2017 · 6 revisions

To run grunt test-sauce locally, you need to get the username and access key from our saucelabs account. Ask someone on the plottable team for this information. After acquiring this information, run the following commands.

export SAUCE_USERNAME=[username here]

export SAUCE_ACCESS_KEY=[access key here]

For people with access credentials to the saucelabs, in order to find the username and access key, go to this page. Prior to visiting it, login with the username and password. Under the Adding Credentials for GitHub repo, enter palantir/plottable. Don't use the hashed credentials, but instead scroll down to where it says

travis encrypt SAUCE_USERNAME=[user_name] --add

travis encrypt SAUCE_ACCESS_KEY=[access_key] --add

Use the [user_name] and [access_key] for connection.

After doing this, you should be able to just run grunt test-sauce. This process can take anywhere from 3-5 minutes. After running, you should see something like this in the output:

$ grunt test-sauce
Running "connect:server" (connect) task
Started connect web server on http://localhost:9999

Running "saucelabs-mocha:all" (saucelabs-mocha) task
=> Starting Tunnel to Sauce Labs
>> Connected to Saucelabs

 1 / 3 tests started

 2 / 3 tests started

 3 / 3 tests started


Tested http://127.0.0.1:9999/test/tests.html
Platform: ,chrome,35
Passed: true
Url https://assets.saucelabs.com/jobs/59cd68fe8cc6431b8d19935b208ee07c


Tested http://127.0.0.1:9999/test/tests.html
Platform: WIN8,internet explorer,10
Passed: true
Url https://assets.saucelabs.com/jobs/59b7259a6b9e4d5d8225afdad2ea2108


Tested http://127.0.0.1:9999/test/tests.html
Platform: WIN7,internet explorer,9
Passed: false
Url https://assets.saucelabs.com/jobs/5ea4c1cfb3874d87a9b3899d2d53afa1
>> All tests completed with status false
=> Stopping Tunnel to Sauce Labs
Warning: Task "saucelabs-mocha:all" failed. Use --force to continue.

Aborted due to warnings.

This shows that IE9 tests failed, so we can follow the assets.saucelabs link to see which ones.

Here's an example of a successful run.

$ grunt test-sauce
Running "connect:server" (connect) task
Started connect web server on http://localhost:9999

Running "saucelabs-mocha:all" (saucelabs-mocha) task
=> Starting Tunnel to Sauce Labs
>> Connected to Saucelabs

 1 / 2 tests started

 2 / 2 tests started


Tested http://127.0.0.1:9999/test/tests.html
Platform: ,chrome,35
Passed: true
Url https://assets.saucelabs.com/jobs/380a7f978e4b44258426da9ce8e0f7c4


Tested http://127.0.0.1:9999/test/tests.html
Platform: WIN8,internet explorer,10
Passed: true
Url https://assets.saucelabs.com/jobs/dd905fa8b3b9465e8cd01c1720be8ff6
>> All tests completed with status true
=> Stopping Tunnel to Sauce Labs

Done, without errors.

These Sauce Labs tests will also automatically run on a push.