Status badges and the Sauce Labs browser matrix widget help you keep track of the status of your latest test runs. All you have to do is add either markdown or HTML code to your GitHub README or project site that references your Sauce Labs username and access key, and annotate your jobstests with the REST or WebDriver API.
|Table of Contents|
Status Badges and the Browser Matrix
There are three four status badges that correspond to the three states of a finished test: Passing, Failed, Error, and Unknown.
|This status is set if the build errors out due to an internal error (one or more sessions have crashed)|
|This status is set if one or more jobs of the latest build haven't been reported as passed or failed. This state is equivalent to Finished.|
With the browser matrix, you can keep track of the test status of your project for various browser/platform/operating system combinations.
Setting Up Status Badges for Test Results
Choose a Sauce account to associate with your project. If you just have one project, you can use your main Sauce account name. If you have multiple projects, you will want to create a sub-account for each project.
Run your tests for a given project on Sauce using that account's username and access key. If you are logged in as the account you want to use, you can find your credentials on the account page. If you are logged in as a parent account, you can see your sub-account usernames and access keys on the sub-accounts page.
Make sure to set a build number a pass/fail status and a visibility (to either 'public', 'share' or 'public restricted') for every test that runs. You will be able to see that these are set correctly by seeing that your tests say "Pass" or "Failed" instead of "Finished" and that a build number is visible in the UI.
Note: If your tests don't have a build or pass/fail status, you'll get the "Unknown" image for security reasons.
You can copy/paste the following Markdown into your GitHub README:Build Status Badge Example
Browser Matrix Badge Example
Setting Up Status Badges for Test Results
Copy this markdown code into your GitHub README.
[![Sauce Test Status](https://app.saucelabs.com/buildstatus/
Alternatively, you can
use this HTML code on your project site
Code Block language xml
YOUR_SAUCE_USERNAME"> <img src="https://app.saucelabs.com/buildstatus/
YOUR_SAUCE_USERNAME" alt="Sauce Test Status"/> </
Tip title Multiple Projects, Multiple Accounts
If you just have one project, you can use your main Sauce account name. If you have multiple projects, you will want to create a sub-account for each project.
Run your tests.
Make sure to set a build number, a pass/fail status, and a public, share, or public restricted visibility for every test that runs using the Test Configuration Options.
You'll know that these are set correctly if your tests have a status of Pass or Failed instead of Finished on your dashboard, and that a build number is also displayed.
Setting Up the Browser Matrix Widget
You can copy/paste the following Markdown into your GitHub README:Copy this markdown code into your project's GitHub README.
[![Sauce Test Status](https://app.saucelabs.com/browser-matrix/
Or Alternatively, you can add the following this HTML to your project site:.
YOUR_SAUCE_USERNAME"> <img src="https://app.saucelabs.com/browser-matrix/
YOUR_SAUCE_USERNAME.svg" alt="Sauce Test Status"/> </
Note that the above information applies to Open Sauce accounts only. Open Sauce accounts are public, meaning tests and build status can be viewed without authentication. In order to use the above for any other type of account, read on.
Status Images for Private Accounts
To If you want to display the build status of a private Sauce account, you need to provide a Hash-based Message Authentication Code (HMAC) token generated from your username and access key. Here is how you could generate one in python:
Note: if you don't have python on your system, check out this link for HMAC http://en.wikipedia.org/wiki/HMAC#External_links
First start the python interpreter with the following command:
Then run the following code in the interpreter to generate a query param to add to badge image URLs:
This example shows how to generate an HMAC token using Python:
python from hashlib import md5 import hmac "?auth=" + hmac.new("
YOUR_SAUCE_USERNAME:YOUR_SAUCE_ACCESSKEY", None, md5).hexdigest()
Once the auth token has been obtained, it can be appended to one of the above badge URLs as the value of the
auth query like this:
This is an example to show that the HMAC token should be generated using your Sauce Labs username and access key. You can find many examples of how to accomplish this in other languages with a quick web search, such as here. As the above example shows, the HMAC token should be generated using the md5 cryptographic algorithm, and with no secret.
Once you have the token, append it to the badge URL:
Follow the instructions below to run the sample demo that exists in the
saucelabs-training GitHub organization:
|View Git file|