Reputation: 379
We are using the Azure DevOps Test Plan module for our manual testing. We have a Test Plan, under which, we have Test Suite, under which we have Test Cases that are assigned to different Testers. Testers use ADO to mark a Test Case outcome as passed or fail.
We want to download the Test Case outcome/results, but I don't see that option. We have a Test Run tab under Test Plan which shows all Run outcomes but doesn't give the option to download.
Upvotes: 1
Views: 3837
Reputation: 379
Below are the steps to download the Test Run results from ADO –
Navigate to Test Plan -> Runs
Click on filters, remove all filters and run the query
Click on one result and press Ctrl + A and then Ctrl + C
Paste the content in Notepad++, then copy the content from Notepad++ and paste it Excel.
This will give you list of all Test Runs with results. You can get the latest outcome of test run, by sorting data using Run ID in descending order and then using unique rows only.
Upvotes: 0
Reputation: 35099
I am afraid that there is no out-of-box method can directly export the test results of test runs to excel.
To meet your requirement, you can use Rest API to list all required test runs and test results. Then you can export them to Excel.
You can use the following two Rest APIs:
Get Test Runs: Runs - Query
GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?minLastUpdatedDate={minLastUpdatedDate}&maxLastUpdatedDate={maxLastUpdatedDate}&state={state}&planIds={planIds}&isAutomated={isAutomated}&publishContext={publishContext}&buildIds={buildIds}&buildDefIds={buildDefIds}&branchName={branchName}&releaseIds={releaseIds}&releaseDefIds={releaseDefIds}&releaseEnvIds={releaseEnvIds}&releaseEnvDefIds={releaseEnvDefIds}&runTitle={runTitle}&$top={$top}&continuationToken={continuationToken}&api-version=7.0
Get Test Results: Results - List
GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?detailsToInclude={detailsToInclude}&$skip={$skip}&$top={$top}&outcomes={outcomes}&api-version=7.0
Here is PowerShell sample:
$token = "PAT"
$url=" https://dev.azure.com/orgname/projectname/_apis/test/runs?api-version=7.0"
$token = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$($token)"))
$response = Invoke-RestMethod -Uri $url -Headers @{Authorization = "Basic $token"} -Method Get -ContentType application/json
echo $response
ForEach( $testrunid in $response.value.id )
{
echo $testrunid
$url1 ="https://dev.azure.com/orgname/projectname/_apis/test/Runs/$($testrunid)/results?api-version=7.0"
$response1 = Invoke-RestMethod -Uri $url1 -Headers @{Authorization = "Basic $token"} -Method Get -ContentType application/json
ForEach( $testresult in $response1.value)
{
$outcome = $testresult.outcome
$startedDate = $testresult.startedDate
$testCase =$testresult.testCase.name
$completedDate = $testresult.completedDate
$testCaseTitle = $testresult.testCaseTitle
echo $outcome
echo $startedDate
$Output = New-Object -TypeName PSObject -Property @{
outcome = $outcome
runid =$testrunid
startedDate = $startedDate
completedDate= $completedDate
testCase = $testCase
testCaseTitle = $testCaseTitle
} | Select-Object runid, outcome,startedDate,testCase,testCaseTitle,completedDate
$Output | Export-Csv C:\testresult.csv -Append
}
}
You can customize the output excel column according to your requirements.
Result:
Upvotes: 1
Reputation: 2196
You could Export the test plan properties, test suite properties along with details of the test cases and test points as either an email or print to pdf by using the Export function of the test suite: doc
Make sure you have test access and permission in Azure DevOps.
Upvotes: 0