Customize Your Workflow Notifications with App Center and Azure Logic Apps
Our customers love App Center because it provides them with a feature-rich Continuous Integration (CI) service that works for the most common scenarios. In many cases, developers need to extend a specific service or feature to make it fit into their existing workflow. As an API-first product, we try to either build these features, or provide an API that developers can plug in to other services to customize their workflow and achieve their specific scenario.
When building an app, it’s important to stay in the know by getting continuous updates on what’s happening with your app. App Center offers integrations with popular collaboration tools including Microsoft Teams, Slack and others. In this post, I’ll show you how to extend Slack notifications to send automatic status updates for your UI tests, when they are ran part of App Center build process. While App Center doesn’t directly offer this functionality yet, we’ve built a proof of concept to demonstrate how this type of workflow can be achieved by plugging Azure Logic Apps into App Center. Azure Logic Apps allow connecting apps and services to automate workflows with little (or not at all) code written.
One use case we heard about from some customers is summed up as this: “I use App Center for running builds in a continuous manner, and I run a suite of UI tests, using the device cloud offered in App Center, upon every successful build. I already get emails at each test completion. However, my team lives in Slack, and we want to have the result of tests posted in our dedicated Slack channel.” Similar scenarios include posting a message to Microsoft Teams or to bug tracker systems; for instance, creating an issue for any failed test suite that’s blocking a release.
How it Works
I onboarded our sample React Native app to the build service in App Center by connecting its source code repository and triggering a build on the master branch at each push. Post build, a script triggers a test run via App Center Test service using the CLI. Once the tests are kicked off, the post-build script is also triggering the Logic App to monitor the test run. You can see what a similar post build script looks like here and read more details about build scripts in general in the App Center documentation.
Upon kicking off the tests in App Center, the Logic App takes over and does the magic:
Step 1: The Logic App receives an HTTP request containing the test run properties.
Step 2: Logic App posts that the tests are under way in the configured Slack channel.
Step 3, 4: Logic App tracks when the tests are completed in App Center.
Step 5: When the UI tests are completed, Logic App posts the results on Slack.
If you want to try this workflow yourself, you can create a new Azure Logic App in your Azure subscription and use this snippet to get started quickly. Keep in mind that you’ll need to add your Slack connection as an HTTP Webhook.
Similar workflows can integrate with Microsoft Teams, to a custom webhook, or to any other endpoint. Need other customizations on your Continuous Integration and delivery workflows? Share them with using the live chat window in App Center. If you’re already using build scripts to customize your builds, share it with the community and open a Pull Request in the build scripts repository!