Experiences, small talk, and other automation gossip.
-
uha
- Posts: 2
- Joined: Tue Jul 19, 2022 2:41 pm
Post
by uha » Tue Jul 19, 2022 3:59 pm
Dear all,
hope this is the correct area to start this thread!
I am looking for a best practice or ideas to archive test reports when using Azure
release pipelines!
Some background information:
- I have created a build pipeline which builds the Ranorex solution and creates the artifact.
- This artifact is used in different release pipelines to run the UI tests, because I want to run different test configurations on different systems.
Some thoughts:
- I could store the reports on a network drive or in Azure Storage - but do you have better ideas?
- The Azure Pipeline Integration documentation (https://www.ranorex.com/help/latest/int ... -pipeline/) uses a build pipeline and stores the reports as an artifact. I like that the reports (artifact) are directly linked with the build, because everything is traceable in the future. But I want to have build and release Pipelines sperated.

How do you manage/archive your test results?

Any idea, thought, etc. ... will be apreciated!
Thanks in advance!
-
odklizec
- Ranorex Guru

- Posts: 7469
- Joined: Mon Aug 13, 2012 9:54 am
- Location: Zilina, Slovakia
Post
by odklizec » Mon Aug 08, 2022 11:14 am
Hi,
Here is the piece of code I'm using to publish test results and attaching report files in test summary...
DevOps_rxlogs.png
Code: Select all
- task: [email protected]
displayName: Publish test results
continueOnError: true
inputs:
testResultsFormat: 'JUnit'
testResultsFiles: '**/unpacked/RXReport_*_build-*_*.rxlog.junit.xml'
searchFolder: '$(System.DefaultWorkingDirectory)/Reports'
mergeTestResults: true
testRunTitle: 'QA UI (Ranorex) Test Results'
- task: [email protected]
displayName: Attach Ranorex report to test summary
continueOnError: true
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs:
targetType: 'inline'
script: |
$AzureDevOpsAuthenicationHeader = @{Authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"}
# Build Id
Write-Host "buildID: $(Build.BuildId)"
$url = 'https://dev.azure.com/company/project/_apis/test/ResultDetailsByBuild?buildId=$(Build.BuildId)'
$response = Invoke-RestMethod -Uri $url -Headers $AzureDevOpsAuthenicationHeader -Method Get
Write-Host "response = $($response)"
# get test run Id
$testRunId = $($response.resultsForGroup.results[0].testRun.id)
Write-host "test run number = $($testRunId)"
$rxzlogFileNames = Get-ChildItem -Path $(System.DefaultWorkingDirectory)\Reports -Recurse -Filter "RXReport_*_build-$(Build.BuildNumber)_Failed.rxzlog"
foreach($logfilename in $rxzlogFileNames)
{
# convert file to base64 string
$base64string = [System.Convert]::ToBase64String([IO.File]::ReadAllBytes($logfilename.fullname))
Write-host "Converted string = $($base64string)"
# create request body
$BuildReqBody= @{stream=$base64string;fileName="$($logfilename.name)";comment="Ranorex report";attachmentType="GeneralAttachment"}
$BuildReqBodyJson = $BuildReqBody | ConvertTo-Json -Compress
# attach report to test run
$htmlReportFile = Invoke-RestMethod -Uri "https://dev.azure.com/company/project/_apis/test/Runs/$testRunId/attachments?api-version=6.0-preview.1" -Method Post -ContentType 'application/json' -Body $BuildReqBodyJson -Headers $AzureDevOpsAuthenicationHeader
}
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at
Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration