One of the great things about Slack is the long list of integrations available. Whether it’s an integration as foundational as Google Drive, GitHub, or Zendesk — or as whimsical as Lunch Train — there are Slack integrations for a wide range of use cases.
Here’s an example of Slack’s GitHub integration:
With that backdrop, we’d like to show you how to integrate your Applitools Eyes visual UI test results into one of your Slack channels — something that our customers have frequently requested.
This step-by-step tutorial uses the Slack incoming webhooks API.
First, some background:
Slack provides APIs to users to create applications and to automate processes, such as sending automatic notifications based on human input, sending alerts on specified conditions, and more. The Slack API has been noted for its compatibility with many types of applications, frameworks, and services.
Once you build this tutorial, you’ll be able to view test results on any Slack client: your laptop, your phone. Or even via notifications on your Apple Watch, if you’re stuck in a meeting and don’t want to open your phone. You’ll be the first to know if your app has a visual glitch that you’ll need to fix.
With that, let’s dive into what you need to do to bring Applitools into your Slack channel:
Step 1: Set up your Slack endpoint
- Per Slack recommendations, create a “sandbox” account for Slack for your experiments before integrating it with your team Slack account: https://slack.com/create
- Follow these instructions to see how you post your first “Hello world” message to your new Slack channel: https://api.slack.com/tutorials/slack-apps-hello-world
- Copy and keep your webhook URL (always better to add this webhook URL to your environment variables, but I’ll leave it to you).
Step 2: Getting Applitools Eyes Test Results
- Switch to whatever IDE you use to write automated test scripts that call the Applitools API, and open one of those scripts.
TestResults res = eyes.close(false);
- This call returns a TestResults object. Additional information about Applitools TestResults can be found here.
Step 3: Connecting The Dots
1. Create class EyesSlack and add the following code in it:
2. Now let’s see how we use this class in our tests:
3. All you need to do now is run it to see your Applitools Eyes Test Results right in your Slack channel.
Here is an example of the screen message in Slack:
If you want to see my own experience putting together this blog post, check out this video:
Now that you tested it in your sandbox you are ready to merge into your team slack account – simply replace the webhook URL and you are good to go.
Looking for additional integrations with Applitools? Here are my favorites: