Skip to main content

Slack Integration

The Sauce Labs Slack app allows you to easily share your test results in Slack. You can:

  • Share a test result link in Slack, and it automatically expands to show the test summary
  • Configure saucectl to automatically post test result notifications to selected channels in Slack

What You'll Need#

Install the Sauce Slack App for Your Organization#

Org Admin Required

Before the Sauce Slack app can be used by members of the organization, an Org Admin must install it for whole the organization and associate it with your Slack workspace. If you are an Org Admin, you can do this by:

  1. From your Sauce Labs account, navigate to the Account Integrations page.
  2. Click the Install button of the Slack integration app.
  3. A secondary browser window opens, prompting you to sign into your Slack workspace.
  4. Once you have signed in, click Allow to give Sauce Labs permission to access your Slack workspace.
  5. At the confirmation screen, close the secondary browser window to return to your Sauce Labs screen.
Multiple Data Centers

If your Sauce Labs account has access to multiple data centers, you need only install the plugin once and it will be available for all data centers to which the account has access. If your access to different data centers is through different Sauce Labs accounts, you must install and setup the plugin separately for each Sauce Labs account.

If you are not an Org Admin and the Slack Integration Install button is disabled, contact your Org Admin to enable the integration with your workspace.

Share Test Results in Slack#

Once the Sauce Labs Slack app has been enabled for your Sauce Labs organization and Slack workspace, when you post a link to a test results page in a Slack channel, the link will automatically unfurl to show the Test Results summary, as shown in the following image.

Test Result Summary Example

Enable Notifications from saucectl#

Setting up automatic notifications from saucectl requires you to first add the Sauce Labs app to any channels to which you will send notifications, then edit your saucectl configuration file to specify when to send notifications and to what channel.

Add the Sauce App to Notification Channels#

  1. In your Slack workspace, select the channel from the sidebar.
  2. Click the dropdown at the end of the channel title to access the settings menu for the channel.Set Channel Details
  3. Select the Integrations tab, then the Add an App button.
  4. Click the Add button for the Sauce Labs app to enable notifications for the channel.

Configure Notifications from saucectl#

  1. In the config.yaml file that defines your saucectl test configuration settings, add the notifications.slack property.

    notifications:  slack:    channels:      - "saucectl-results"      - "cypress-tests"    send: always

    Make sure you have added the app to the channels you specify in your configuration. Otherwise, saucectl will return an error at the completion of your test stating that the app is not in the channel:

    No App in Channel Error
  2. Specify the names of one or more channels in your Slack workspace to which you want the test results sent.

  3. Specify when to send notifications to specified Slack channels. Valid values are:

    • always: Send notifications for all test results.
    • never: Do not send any test result notifications.
    • pass: Send notifications for passing suites only.
    • fail: Send notifications for failed suites only.

When you run your tests with the notifications configuration applied, any completed test suites that match your criteria trigger a notification in your specified channels, as shown in the following illustration:

Sample Alert

Test Summary Information#

When test results are shared to Slack, they include the following details about the job and the results of each suite within the job.

Job Details

  • The framework on which the test ran
  • The Build ID (if any) applied to the job
  • The username of the Sauce Labs account that executed the test
  • The date and time at which the job completed

Test Suite Details

  • The result of the test suite
  • The name of test suite
  • The Operating System on which the test suite ran
  • The browser on which the test suite ran (web-app tests)
  • The device or emulator on which the test suite ran (mobile-app tests)
  • The duration of the test

In addition, the notifications include a color-coded sidebar for a quick indication of the test result; green if all suites in the job passed, and red if any of the the suites in the job failed.