You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Microsoft Azure, aka Azure, is a cloud computing service created by Microsoft for building, testing, deploying, and managing applications and services through Microsoft-managed data centers.
28
+
Integrate Testsigma with Azure DevOps to trigger Test Plan executions from your CI/CD pipeline. Azure DevOps runs a shell script that calls the Testsigma API to start a Test Plan and fetch its results.
23
29
24
30
---
25
31
26
32
> <pid="prerequisites">Prerequisites</p>
27
33
>
28
34
> Before you begin, ensure that you have referred to:
29
-
> 1.[Documentation on generating API keys](https://testsigma.com/docs/configuration/api-keys/).
30
-
> 2. <ahref="https://s3.amazonaws.com/website-static-docs.testsigma.com/new_images/projects/Updated_Doc_Images/get-test-plan-id.png"rel="nofollow">Documentation on getting test plan ID</a>.
35
+
> 1.[Documentation on generic Shell script](https://testsigma.com/docs/continuous-integration/shell-script/) to get the script file.
36
+
> 2.[Documentation on generating API keys](https://testsigma.com/docs/configuration/api-keys/).
37
+
> 3.[Documentation on getting test plan ID](https://testsigma.com/docs/continuous-integration/get-test-plan-details/).
31
38
32
39
---
33
-
## **How to integrate with Azure DevOps**
34
-
1. Login to the Azure DevOps account and create a **Project**. Navigate to Pipelines and click on the **New Pipeline** to get started.
40
+
41
+
## **Prepare the Shell Script**
42
+
43
+
1. Copy the Unix shell script from the [documentation on generic Shell script](https://testsigma.com/docs/continuous-integration/shell-script/).
44
+
45
+
[[info | NOTE:]]
46
+
| Use the Unix shell script if your system runs macOS or Linux. Use the script under **For Powershell Script** on the same page if your system runs Windows.
47
+
48
+
2. Generate an API key from **Configurations > API Keys**. The link is mentioned in the prerequisites.
49
+
50
+
3. Get the Test Plan ID from the **CI/CD Integrations** tab on the Test Plan details page. The link is mentioned in the prerequisites.
51
+
52
+
4. Replace **TESTSIGMA\_API\_KEY** and **TESTSIGMA\_TEST\_PLAN_ID** in the script with the values from steps 2 and 3.
53
+

54
+
55
+
5. Save the script in the code repository that you'll use for the Azure DevOps pipeline. Name it **cicd-api.sh**.
56
+
57
+
[[info | NOTE:]]
58
+
| This script triggers the Test Plan execution and returns the result once the run is complete.
59
+
60
+
---
61
+
62
+
## **Create the Azure DevOps Pipeline**
63
+
64
+
1. Sign in to your Azure DevOps account.
65
+
66
+
2. Create a **Project**.
67
+
68
+
3. Navigate to **Pipelines** and click **New Pipeline**.
35
69

36
70
37
-
2. Choose the **Version Control System** (VCS) where your application code is stored.
71
+
4. Select the version control system (VCS) where your code repository, including **cicd-api.sh**, is stored.
38
72

39
73
40
-
41
74
[[info | NOTE:]]
42
-
| In order to integrate with Azure, you need to have a YAML file in your Code repository. This file contains the details for the CI/CD Integration with Azure DevOps. If not available yet, Azure has an option in which it will create a sample YAML file in your repository once access is given.
75
+
| Azure DevOps requires a YAML file in your code repository to configure the CI/CD pipeline. If your repository doesn't have one, Azure DevOps creates a sample YAML file in your repository once you grant access.
43
76
44
-
3. Choose the repository where your Configuration YAML file is present. Once you select your repository it will take you to the configuration page where you can configure your pipeline.
77
+
5. Select the repository that contains your configuration YAML file.
45
78

46
-
47
-
4. On **Configure your pipeline** page, if you already have your YAML file in your repo, you can select the option **Existing Azure Pipeline YAML file**. Otherwise, you can select **Starter Pipeline** to create a sample YAML file in the selected repository.
48
-

49
-
50
79
51
-
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 will take you to a place where you need to enter the branch and path of the YAML file in your repository.
52
-

80
+
6. On the **Configure your pipeline** page, select **Existing Azure Pipelines YAML file** if your repository already has one, or select **Starter pipeline**to create a sample file.
81
+

53
82
83
+
**(If using an existing file)**: Enter the branch and path of the YAML file in your repository.
84
+

54
85
55
-
5. Review the CI Configuration after selecting the Branch and Path, click on**Continue**.
86
+
7. Review the CI configuration, then click **Continue**.
56
87

57
88
58
-
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. For more information on generic shell script, refer to the [documentation generic shell script](https://testsigma.com/docs/continuous-integration/shell-script/). This Shell script is the one that actually triggers the Test Plan execution and gives you the result of Test plan once it's complete.
89
+
8. In the YAML file, enter the path to **cicd-api.sh** in the `filePath` field:
59
90
60
91
```yaml
61
92
# Azure Pipelines YAML file
@@ -69,9 +100,9 @@ steps:
69
100
displayName: Run a one-line script
70
101
71
102
- task: Bash@3
72
-
displayName: Run Shell Script (./cd-api.sh)
103
+
displayName: Run Shell Script (./cicd-api.sh)
73
104
inputs:
74
-
filePath: ./cd-api.sh
105
+
filePath: ./cicd-api.sh
75
106
76
107
- task: PublishTestResults@2
77
108
displayName: publish test-results
@@ -80,28 +111,26 @@ steps:
80
111
testResultsFiles: '**/*junit-report.xml'
81
112
```
82
113
114
+
---
83
115
84
-
85
-
In order to Trigger a 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:
86
-

87
-
88
-
For more information on configuration of Generic Shell Script, refer to https://testsigma.com/docs/continuous-integration/shell-script/.
116
+
## **Run the Pipeline and View Results**
89
117
90
-
6. Test the configuration once the script is set up and reviewed for the pipeline, and click on the **Run** to start your Job.
118
+
1. Click **Run** to start the pipeline job.
91
119

92
120
93
-
Once the Run is initiated, you will see this page:
121
+
2. Track the run on the pipeline results page.
94
122

95
123
96
-
Once the job has been completed, the Job status will be **Success** as shown in the image below:
124
+
3. Once the job completes, the job status shows **Success**.
97
125

98
126
99
-
7. Once the job is completed we can see the reports in the **Test Plans > Runs**.
127
+
4. Navigate to **Test Plans > Runs** to view the reports.
100
128

101
129
102
-
After clicking on **Runs** you can select the Test plan for which you want to view the report and then you will be navigated to the page below, and also you can download the JUnit report in XML format.
130
+
5. Select **Runs**, then select the Test Plan whose report you want to view. Download the JUnit report in XML format from this page.
103
131

104
132
105
-
You can use another shell script to convert the JUnit XML format result into an HTML format.
106
-
133
+
[[info | NOTE:]]
134
+
| Use a separate shell script to convert the JUnit XML report into HTML format.
0 commit comments