The Sauce Labs Cookbook

Sauce Headless

Front End Performance Testing

Insights

External Resources

More Info


Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

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 jobs with the REST or WebDriver API

Status Badges and the Browser Matrix

There are three status badges that correspond to the three states of a finished test: Passing, Failed, and Unknown.

BadgeStatus
Passing
Failed
Unknown - used for security reasons when a test doesn't have a status of Passing or Failed

With the browser matrix, you can keep track of the test status for various browser/platform/operating system combinations.

Setting Up Status Badges for Test Results

  1. Copy this markdown code into your GitHub README.

    [![Sauce Test Status](https://saucelabs.com/buildstatus/YOUR_SAUCE_USERNAME)](https://saucelabs.com/u/YOUR_SAUCE_USERNAME)

    Alternatively, you can use this HTML code on your project site.

    <a href="https://saucelabs.com/u/YOUR_SAUCE_USERNAME">
      <img src="https://saucelabs.com/buildstatus/YOUR_SAUCE_USERNAME" alt="Sauce Test Status"/>
    </a> 

    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. 

  2. Run your tests.

  3. Make sure to set a build number, a pass/fail status, and a public, share, or public restricted visibility for every test that runs with the test configuration API.
    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

Copy this markdown code into your project's GitHub README.

[![Sauce Test Status](https://saucelabs.com/browser-matrix/YOUR_SAUCE_USERNAME.svg)](https://saucelabs.com/u/YOUR_SAUCE_USERNAME)

Alternatively, you can add this HTML to your project site.

<a href="https://saucelabs.com/u/philg">
  <img src="https://saucelabs.com/browser-matrix/philg.svg" alt="Sauce Test Status"/>
</a> 

Status Images for Private Accounts

If you want to display the build status of a private Sauce account, you need to provide an 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:

python

Then run the following code in the interpreter to generate a query param to add to badge image URLs:

from hashlib import md5
import hmac
"?auth=" + hmac.new("philg:45753ef0-4aac-44a3-82e7-b3ac81af8bca", 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:

?auth=AUTH_TOKEN

  • No labels