This article refers to integrating with Azure DevOps Boards and Work Items. If you’re looking for information about CI/CD integrations, please see the documentation on Integrating with Azure Pipelines.
TestRail integrates with Azure DevOps so your team can link, view, add, and push issues between TestRail and Azure DevOps as bugs/defects, requirements/references, or both. The TestRail integration with Azure DevOps supports the following use cases:
You don’t have to use all the listed integration options; you can mix and match the integration with other tools. Configuring the integration usually only takes a few minutes. This guide explains how to configure the integration and how it works.
Link test cases to requirements
To set up test coverage, when you are creating or editing test cases, simply add one or more work item IDs (separated by commas) to the References field.
The References you set in your test cases will be converted to a direct link to Azure DevOps work items.
Configuring the Reference View Url
To link test cases to requirements, you should configure the Azure DevOps Reference View Url in TestRail by following the steps below.
-
- Go to the Administration page, select Integration to configure globally or Projects for a single project, and open the References tab
- Insert your Reference View Url using the following pattern
https://<Azure_DevOps_URL>/<Project>/_workitems/edit/%id%/
- Click Save Settings
Please make sure to replace <Azure_DevOps_URL>
and <Project>
with the actual URL of the instance and the Project name in Azure DevOps you want to integrate with.
Start creating requirements from TestRail
TestRail provides an Add link in the test case editor view to quickly navigate to the Azure DevOps work item creation screen. This allows you to quickly create new requirements you want to trace in your test cases. Note that after creating your new work item, you need to copy and paste its ID to the References field.
Configuring the Reference Add Url
To start creating new requirements from TestRail, you should configure the Azure DevOps Reference Add Url in TestRail by following the steps below.
-
- Go to the Administration page, select Integration to configure globally or Projects for a single project, and open the References tab
- Insert your the Reference Add Url using the following pattern
https://<Azure_DevOps_URL>/<Project>/_workitems/create/issue
- Click Save Settings
View requirements in TestRail
TestRail can retrieve additional information from IDs entered into the References field of TestRail entities, such as test cases, test runs, and milestones. Simply hover over the links and a dialog will show you all the latest information without having to navigate to Azure DevOps.
Configuring the Reference Plugin
To view requirements directly in TestRail, you should configure the Azure DevOps Reference Plugin in TestRail by following the steps below.
-
- Go to the Administration page, select Integration to configure globally or Projects for a single project, and open the References tab
- Select your Azure_DevOps_ variant in the Reference Plugin drop-down list (CLOUD if your team uses Azure DevOps Services, SERVER if your team uses Azure DevOps Server)
- Configure the connection settings in the [connection] section
- address:
https://<Azure_DevOps_URL>
- project: name of your project
- user: your username
- password: your Azure DevOps password or Personal Access Token (PAT)
- address:
- Click Save Settings
It is also possible to customize the fields which appear via link hovering. You can see more information on how to do it on the Customizing the Requirement/Defect Plugins section.
The Defect Plugin utilizes Azure DevOps API, so valid credentials are needed to connect to the API. You’ll have to generate an Azure Personal Access Token with Full Access or Custom Defined with all permissions to Work Items.
Link defects to test results
The Defect View URL is used to build a link to Azure DevOps based on the Defect ID, so you can simply click on an ID to open the issue directly in Azure DevOps.
When you set up the Defect View URL integration with Azure DevOps Issues, you can paste the ID of an Azure DevOps issue in the Defects field of a test result and TestRail will automatically convert that ID into a clickable link to view the issue in Azure DevOps. This allows your team to link tests with Azure DevOps issues and create defect and traceability reports in TestRail.
Configuring the Defect View Url
To link defects to test results in TestRail, you should configure the Azure DevOps Defect View Url in TestRail by following the steps below.
-
- Go to the Administration page, select Integration to configure globally or Projects for a single project, and open the Defects tab
- Insert your Defect View Url using the following pattern
https://<Azure_DevOps_URL>/<Project>/_workitems/edit/%id%/
- Click Save Settings
Please make sure to replace <Azure_DevOps_URL>
and <Project>
with the actual URL of the instance and the Project name in Azure DevOps you want to integrate with.
Submit new defects in Azure DevOps
TestRail provides quick navigation to report defects using the Azure DevOps interface. You can do it from two different places – the Defects menu and the Add Test Result dialog.
The Defects menu, also know as TestRail’s Defect From Anywhere feature, is displayed on top of most pages for quick access.
The Add Test Result dialog displays the Add link next to the Defects field for quickly and conveniently navigate to DevOps in order to submit a defects when your test is failing.
Note that after you create the defect in Azure DevOps, you should copy and paste the work item ID into the Defects input field to create traceability from your test result back to Azure DevOps.
Configuring the Defect Add Url
To quickly navigate to Azure DevOps to create a new defect, you should configure Azure DevOps Defect Url in TestRail by following the steps below.
-
- Go to the Administration page, select Integration to configure globally or Projects for a single project, and open the Defects tab
- Insert your Defect Add Url using the following pattern
https://<Azure_DevOps_URL>/<Project>/_workitems/create/issue
- Click Save Settings
Please make sure to replace <Azure_DevOps_URL>
and <Project>
with the actual URL of the instance and the Project name in Azure DevOps you want to integrate with.
By default, we suggest using /issue
on the Defect Add Url. The Azure Basic Process does not contain the Bug Work Item type, but in case you are using an Agile/SCRUM/CMMI Process, you can replace /issue
with /bug
, or any other type you may prefer.
Submit new defects from TestRail
For a deeper integration when it comes to reporting defects, TestRail comes with a ready-to-use Azure DevOps defect plugin. This plugin allows you to push new issues to Azure DevOps without leaving TestRail.
Using the built-in Push Defect dialog, you can quickly create a new defect with a title, description, and any other fields supported by Azure DevOps.
You can open the defect submission dialog from two places – the Defects menu and the Add Test Result dialog.
The Defects menu, also know as TestRail’s Defect From Anywhere feature, is displayed on top of most pages for quick access.
The Add Test Result dialog displays the Push link next to the Defects field to efficiently report a defect while you’re submitting your test results.
Configuring the Defect Plugin
To submit new defects straight from TestRail, you should configure the Azure DevOps Defect Plugin in TestRail by following the steps below.
-
- Go to the Administration page, select Integration to configure globally or Projects for a single project, and open the Defects tab
- Select your Azure_DevOps_ variant in the Defect Plugin drop-down list (CLOUD if your team uses Azure DevOps Services, SERVER if your team uses Azure DevOps Server)
- Configure the connection settings in the [connection] section
- address:
https://<Azure_DevOps_URL>
- project: name of your project
- user: your username
- password: your Azure DevOps password or Personal Access Token (PAT)
- address:
- Click Save Settings
It is also possible to customize the fields which appear via link hovering. You can see more information on how to do it on the Customizing the Requirement/Defect Plugins section.
The Defect Plugin utilizes Azure DevOps API, so valid credentials are needed to connect to the API. You’ll have to generate an Azure Personal Access Token with Full Access or Custom Defined with all permissions to Work Items.
View defects in TestRail
Simply hover over defect links and a dialog will show you all the latest information without having to navigate to Azure DevOps. These links are available in the test results directly, as well as the Defects section on test runs, test plans and milestones.
Configuring the Defect Plugin
To view defects information directly in TestRail, you should configure the Azure DevOps Defect Plugin in TestRail. If you already configured the Defect Plugin to push defects to TestRail, you should be all set up. If not, please follow the steps below.
-
- Go to the Administration page, select Integration to configure globally or Projects for a single project, and open the Defects tab
- Select your Azure_DevOps_ variant in the Defect Plugin drop-down list (CLOUD if your team uses Azure DevOps Services, SERVER if your team uses Azure DevOps Server)
- Configure the connection settings in the [connection] section
- address:
https://<Azure_DevOps_URL>
- project: name of your project
- user: your username
- password: your Azure DevOps password or Personal Access Token (PAT)
- address:
- Click Save Settings
It is also possible to customize the fields which appear via link hovering. You can see more information on how to do it on the Customizing the Requirement/Defect Plugins section.
The Defect Plugin utilizes Azure DevOps API, so valid credentials are needed to connect to the API. You’ll have to generate an Azure Personal Access Token with Full Access or Custom Defined with all permissions to Work Items.
Advanced customizations
User variables
We recommend using User Variables when configuring any integration credentials. This allows you to provide generic credentials without disclosing them, and also lets users define their own credentials in their personal settings, for better access control. Below you can see an example of how to set variables in your configuration.
user=%azure_username%
password=%azure_password%
Customizing the Requirement/Defect Plugins
The Azure DevOps plugin was built to work with a standard Azure DevOps configuration. TestRail allows you to customize the fields which appear in the Push dialog as well as when hovering over work item IDs, both for requirements and defects. Preconfigured push fields and hover fields can be set to on
or off
in their respective [push.fields]
and [hover.fields]
sections, and you can also change their order, which will be reflected in the UI.
Some fields (such as the title) are always enabled and may not appear in these sections due to always being required by either TestRail or Azure DevOps.
The plugin is available for both Azure DevOps Cloud, and Azure DevOps Server and it has the same functionality, with the exception of 1 field. The Azure DevOps Server plugin does not support the assignee field, due to API limitations.
The Azure DevOps Defect Plugin also supports modifying field properties as well as custom fields.
[push.types]
Bug=on
Epic=off
Issue=on
Task=on
UserStory=off
By default, the plugin supports the item types defined above, with only Bug, Issue, and Task being enabled initially. Within Azure DevOps, different item types have different description-type fields. For example, a Bug in Azure DevOps has Reproduction Steps and System Info Fields, while an Issue item type uses a Description field. These three field types can be enabled and disabled on a per-item type basis using the [type.settings.<item_type>]
section. The default
value is used to specify where the configured TestRail bug description will be populated.
[type.settings.Bug]
description=off
repro_steps=default
system_info=on
In addition to enabling, disabling, or re-organizing fields as described above, it’s also possible to change additional options per field. To do this, you would define a section for the field, such as [push.field.description]
and specify additional options within this section.
[push.field.description]
label=Detailed Description
required=true
Please see below for full list and explanation of the available field options:
Option | Description |
---|---|
api_field |
The key for the field in an API response. Examples are api_field=System.Description and api_field=Microsoft.VSTS.Common.AcceptanceCriteria (Required for custom fields) |
api_list_id |
The ID value of a list field, such as 661eb38e-6f0b-484a-bc53-27a57c2e2d50. The value is obtained from the Azure DevOps API. (Required for custom fields which have type=dropdown ) |
label |
Specifies the display name of the field in the Push Defect dialogue (Required for custom fields) |
size |
Specifies whether the field is displayed as a compact field (compact) or uses the full width of the dialogue (full) |
remember |
Specifies if previously selected values for this field should be remembered and restored the next time the Push Defect dialogue is opened |
required |
Specifies if this field is mandatory or optional and whether users are required to enter a value for this field in the Push Defect dialogue |
type |
Specifies the type of this field, please see section Custom fields below for a list of supported field types. (Required for custom fields – If type=dropdown for a custom field, then api_list_id is also required) |
Custom fields
You can also use the above-mentioned approach to add custom fields to TestRail’s Push Defect dialogue. To do this, simply add a line with your custom field to the [push.fields]
section to add a field.
[push.fields]
# ...
description=on
customfield_customer=on
Then, add a [field.settings.customfield_<field_name>]
section. This section is required so the plugin can push and/or retrieve data from your tool. <field_name>
can be any value, as the field’s properties will be defined inside the corresponding section. The following is an example.
[field.settings.customfield_customer]
api_field=System.Customer
label=Customer
size=compact
type=dropdown
required=true
The following field types are supported:
Field Type | Description |
---|---|
bool |
A Yes/No dropdown menu for True/False, Yes/No, or similar binary values |
date |
A string field which accepts a YYYY-MM-DD or similarly structured date value. Formatting may depend on the integrated tool’s requirements. |
datetime |
A string field which accepts a YYYY-MM-DD HH:MM or similarly structured date and time value. Formatting may depend on the integrated tool’s requirements. |
dropdown |
A dropdown list that allows users to select one of the multiple options |
string |
A small free-text field for up to 250 characters. |
text |
A large free-text field without practical size limitations. |
Attachments
The Azure DevOps Defect Plugin supports submitting attachments to Azure DevOps as well. This field can be turned on and off, but cannot be customized. To submit one or more attachments to Azure DevOps, simply drag the attachment to the attachments or description areas of the push dialog or click on the area to choose an attachment from your file system.