In this post, we will discuss how we can leverage the power of TestProject’s API to integrate with Azure DevOps Service and run automated tests in the TestProject platform as part of your CI/CD flow.
At the end of this post, we will understand how easy it is to achieve a complex architecture like the one shown in the diagram below, with the help of:
- Azure Service Hooks
- TestProject API
- Azure Release Pipelines
Table of Contents
- Pre-requisites
- TestProject API
- Azure DevOps Service
- CI/CD with Azure DevOps and TestProject [Including Detailed Diagram]
- Video Tutorial
Pre-requisite
The following signups are required before we begin with the actual integration:
- TestProject signup (100% free)
- Azure DevOps service signup (free to signup)
In addition, this guide is assuming you have one working test or job created in TestProject, in my case I have already created a job as shown below. To learn more on getting started with TestProject, check out their official maintained documentation or this complete tutorial video series I have created.
Now that we have everything in place – Let’s get started with the actual integration! 👉
TestProjects API
TestProject has a rich set of API and they are very sophisticated to do almost everything you can do in TestProject platform, we can also access from TestProject API.
We are going to make use of one of the many awesome APIs of TestProject which helps us trigger executing a Test Job that we have already created, as seen above (EALocalTest). In our case, we will be using the following API endpoint:
In order to execute the API, we need to supply the following from TestProject web portal:
- Project ID
- Job ID
- And of course the API token (which you can create in TestProject from here.
For more information on working with TestProject API, please watch this video: https://www.youtube.com/watch?v=TsQHOuP04js
Azure DevOps Service
Now we need to configure TestProject to “talk” with Azure DevOps Service. Since Azure DevOps Service is from Microsoft and it supports many tools out in the market, it also supports generic APIs to trigger as a part of its build and release pipeline. Hence, we are going to leverage the same power of Azure DevOps using what is called as Service Hooks.
In Azure, go to your project settings, from there navigate to Service hooks, and proceed to Create a subscription.
Then, select the Web Hooks service in order to provide event communication via HTTP, and hit next.
Here is where the trigger for the Web Hooks happen from Azure DevOps to TestProject Platform, and the following is most important to specify:
- When to trigger the API?
- Which Release pipeline to trigger?
You need to associate the triggering of Azure Service hooks for any specific release in Azure of Azure release pipeline.
We are going to add the Web Hooks and enter the following details which we grabbed from TestProject in the above section.
Your URL should end up looking something like this:
https://api.testproject.io/v2/projects/UKwphfwhHkaBQgYuarfUng/jobs/IRQofWcTyEStSR0AZJkeyA/run
You do not need to fill in the Basic authentication username and password, however you will need to fill in the HTTP headers field with your API key, and that key must have access to the project you intend to use.
The correct format is:
Authorization: {API_KEY}
Once all the details are filled, press Test button to check the handshake of Azure DevOps with TestProject platform and see if the API is triggered. Once successful, you get the message below:
Azure Release Pipeline Integration
Now, make sure the release pipeline specified in the Web Hook is working properly and gets executed once the build pipeline in Azure DevOps is fully completed, which can be done by enabling CD trigger as shown below:
CI/CD with Azure DevOps and TestProject
Now, once any build gets executed while you do code check-in or PR merge, this will call the Release pipeline to execute, which will then call the TestProject API specified in the Web Hooks of Azure DevOps to execute and run the test in the Agent specified in the Job. That said, you can now see the architecture below will come to life 😉
This entire tutorial is also available in a video tutorial format for you to enjoy: