Skip to end of metadata
Go to start of metadata

The Sauce Labs REST API includes an update_job method that uses a put request to set additional test information such as name, tags, and pass/fail status after the test has completed. The Sauce Labs REST API has more information about working with the API. If you want to annotate your tests through this method, you will probably want to build a simple set of functions that perform the put request for you. We've created a Java library for this, and there are also some examples for Python and Ruby

Adding Pass/Fail Status and Build Numbers to Test Results with Frameworks

Annotating your tests with build numbers and Pass/Fail status will help you manage them more effectively in your Dashboard and Archives pages. In addition to using the REST API to set these annotations after your tests have run, you can also use one of our test framework examples to set these and other annotations for you automatically as part of the test execution.

 

Test Configuration Options

OptionDescriptionKeyValue TypeExample

Test Names

Used to record test names for jobs and make it easier to find individual tests
name
string

"name" : "my example name"

Build Numbers

Used to associate jobs with a build number or app version, which is then displayed on both the Dashboard and Archives viewbuildstring"build": "build-1234"

Tagging

User-defined tags for grouping and filtering jobs in the Dashboard and Archives viewtagslist"tags": ["tag1","tag2","tag3"]

Pass/Fail Status

Selenium and Appium handle sending commands to control a browser or app, but don't report to the server whether a test passed or failed. To record pass/fail status on Sauce, set the passed flag on the job. Since you can't know in advance whether a test passed or failed, this flag can't be set in the initial configuration.

passedboolean"passed": "true"

Custom Data

User-defined custom data that will accept any valid JSON object, limited to 64KB in size.customDataobject
"customData": {"release": "1.0", 
                "commit": "0k392a9dkjr", 
                "staging": true, 
                "execution_number": 5, 
                "server": "test.customer.com"}

Examples

Example of Setting Job Info with cURL for OS X/Linux
curl -X PUT \
-s -d '{"passed": true}' \ 
-u YOUR_USERNAME:YOUR_ACCESS_KEY \
https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID 
Example of Setting Job Info with cURL for Windows
curl -X PUT 
-s -d "{\"passed\": true}"
-u YOUR_USERNAME:YOUR_ACCESS_KEY 
https://saucelabs.com/rest/v1/YOUR_USERNAME/jobs/YOUR_JOB_ID
Example of Setting Job Info Using JSON
{
      "name": "my job name",
      "passed": true,
      "public": "public",
      "tags": ["tag1", "tag2", "tag3"],
      "build": 234,
      "customData": {
          "release": "1.0",
          "server": "test.customer.com"
      }
  } 

Other Resources