Azure DevOps :

Azure is a Microsoft product that helps in code build, deployment, and testing and also helps managing applications and services through MS data centers.

Pre-Requisite Before Integration:

1. Generating API key for Azure:
Testsigma lets you generate your API key in a couple of Steps. You just need to login to your account >>Configuration>>API key and then click on Create a New API Key button to generate a new API key. Below is the screenshot of an auto-generated API key in Testsigma.

2. Getting the Execution ID of the Test Plan: 
We can get the execution ID of a test plan by clicking on the test plan and then clicking on the "CI-CD integration".Below is the screenshot of the execution id of a test plan.


Getting Started With Azure DevOps Integration :

Once you are logged in to Azure devops account and created a Project, You can click on the Pipeline section and the below image will be displayed:

To create a new pipeline we need to click on the "New Pipeline" Button to get started. After clicking on the "New Pipeline" button the below page will be displayed where you need to integrate with the version control application(Git Hub, Bitbucket) where your YAML file is located.



NOTE: In order to integrate with Azure you need to have a YAML file in your repository if not available Azure has an option where it will create a sample YAML file in your repository.


Once you have selected the integration, it would take you to a page where it will ask you to choose the repository where your YAML file is present. The below screenshot is for the reference :



Once you select your repository it would take you to the configuration page where you can configure your pipeline. If you already have your YAML file in your repo you can select the option "Existing Azure Pipeline YAML file" else you can select "Starter Pipeline" to select create a sample YAML file in the selected repository. Below is the screenshot for reference :

In this case, we already had an existing YAML file in the repo. So once you select the fourth option in the above image it would take you to a place where you need to enter the branch and path of the YAML file in your repository, Below screenshot is for the reference:


After selecting the Branch and path you can click on "continue" and you will be navigated to the final step where you need to review your YAML code. Screenshot below for the reference:


The YAML file contains the following code where you need to enter the filePath of the Generic Shell Script (cicd-api.sh)to run it.

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:- master
pool:  
vmImage'ubuntu-latest'
steps:- 
scriptecho Hello, world!  
displayName'Run a one-line script'
//Settings
taskBash@3 
 inputs:    
filePath'./cicd-api.sh' //Generic Shell Script file
//Settings
taskPublishTestResults@2  
displayName'publish testsigma test results'  
inputs:    
testResultsFormat'Junit'// Test Result Format   
testResultsFiles'**/junit-report.xml' //Result File Type

In order to Trigger any particular test plan, you just need to add your own Test plan Execution id and the API key in the Shell Script(cicd-api.sh). As shown below:
Please Click here to get insight on the configuration of General Shell Script.
Once the Script is set up and Reviewed for the pipeline, you can click on the "RUN" button to start your Job.

Once the Run is initiated you would be navigated to the below page :



Once the Job has completed the Job status would be "Success" as shown in the image below:
That was all about the Running the Job, Now we would learn how can we see the result reports in Azure.
Once the job is completed we can see the Junit report in the test plan >>runs as shown below :
After clicking on Runs you can select the execution for which you want to view the report and then you would be navigated to the page below, and also you can download the Junit report in XML format.

So that was all about end to end Azure integration with Testsigma.

HAPPY AUTOMATION!