Hi Chris G
Could you please follow the below steps:
- Azure DevOps allows exporting test cases from Test Plans into CSV or Excel. Navigate to Test Plans -> Test Suites -> Select Export to CSV/XLSX -> Download the file.
However, this method only exports test cases, not historical test run results.
- Since the GET API does not provide a reportable format, try using the following API endpoints: List Test Runs:
Get Test Results for a Run:GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?api-version=7.1-preview
GET https://dev.azure.com/{organization}/{project}/_apis/test/runs/{runId}/results?api-version=7.1-preview
- You can use Invoke-RestMethod and Export-Csv to structure and save data.
Save the results as a CSV file.$org = "your-org" $project = "your-project" $token = "your-personal-access-token" $headers = @{ Authorization = "Bearer $token" } $url = "https://dev.azure.com/$org/$project/_apis/test/runs?api-version=7.1-preview" $response = Invoke-RestMethod -Uri $url -Headers $headers -Method Get # Convert API response into CSV $response.value | Export-Csv -Path "TestRuns.csv" -NoTypeInformation Write-Output "Test run data exported successfully!"
Additional References:
https://learn.microsoft.com/en-us/azure/devops/test/bulk-import-export-test-cases?view=azure-devops
Hope this helps!
Please Let me know if you have any queries.