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
saucectlto automatically post test result notifications to selected channels in Slack
What You'll Need
- A Sauce Labs account (if you don't have one, start a free trial)
- Your Sauce Labs Username and Access Key
- A Slack workspace
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:
- From your Sauce Labs account, navigate to the Account Integrations page.
- Click the Install button of the Slack integration app.
- A secondary browser window opens, prompting you to sign into your Slack workspace.
- Once you have signed in, click Allow to give Sauce Labs permission to access your Slack workspace.
- 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.
Enable Notifications from
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
- In your Slack workspace, select the channel from the sidebar.
- Click the dropdown at the end of the channel title to access the settings menu for the channel.
- Select the Integrations tab, then the Add an App button.
- Click the Add button for the Sauce Labs app to enable notifications for the channel.
Configure Notifications from
config.yamlfile that defines your
saucectltest configuration settings, add the
Make sure you have added the app to the channels you specify in your configuration. Otherwise,
saucectlwill return an error at the completion of your test stating that the app is not in the channel:
Specify the names of one or more channels in your Slack workspace to which you want the test results sent.
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:
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.
- 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.