Is it possible to push test steps from Testrail into the repro steps of a bug in Azure DevOps?

88 Views Asked by At

I’ve recently integrated Testrail with Azure DevOps. The integration works fine and we can create new bugs from within Testrail that creates a new bug in Azure. However, what I would like to do is push the test steps from the test that is being ran in Testrail into the repro steps section in the bug work item of azure when I’m creating the bug.

I know that in Azure DevOps if you create a bug from the test runner it will do this but unfortunately all of our testing has migrated out of DevOps to Testrail.

I’ve tried to have a look around and I can see that you can configure various parts of the integration between them but I can’t work out if this is possible or how I’d do it aside from editing the configuration json in some way.

1

There are 1 best solutions below

0
Miao Tian-MSFT On

After my research, I didn't find a convenient way to accomplish your needs. I can provide my idea.

  1. Use this API Exporting test cases to get the test step in Testrail.
  2. Update repro step in DevOps using this REST API: Update a work item field

Here is my sample for step 2

$PAT=""
$orgname=""

$PATGetBytes = [System.Text.Encoding]::ASCII.GetBytes(":$PAT")
$Authentication = [System.Convert]::ToBase64String($PATGetBytes)
$Headers = @{Authorization = ("Basic {0}" -f $Authentication) }
$Uri = "https://dev.azure.com/"+$orgname+"/_apis/wit/workitems/6?api-version=7.2-preview.3"

$body = @"
[
    {
        "op": "add",
        "path": "/fields/Microsoft.VSTS.TCM.ReproSteps",
        "value": "add your steps here"
    }
]
"@

$response = Invoke-RestMethod -Uri $Uri -Method 'PATCH' -Headers $headers -Body $body -ContentType 'application/json-patch+json'
$response | ConvertTo-Json

By the way, this is the document Integrate with Azure DevOps from Testrail for your reference.