Hi,
I’m on Orchstrator version 2021.10.4
I’m building a simple TestCase report and try to verify TestCaseExecutions via the API.
I like to check if there are any screenShots attached (at all). I don’t care about the actual file/content at this point - just to check: is the “TestCaseExecutionAttachments” DTO populated or not?
My problem → TestCaseExecutionAttachments is always empty, even when there is media available. Is this by Design or am I doing something wrong?
Comparing how UiPath Orch does it,
I can see, via the browsers web tool (F12), that UiPath Orch web makes a 2nd additional call to:
ExecutionMedia/UiPath.Server.Configuration.OData.DownloadMediaByJobId()
If there is no data, the UiPath web GUI catch that exception and that’s how it is able to show “no ScreenShots”. But - I don’t want to pull files for 500 Test Case, just to check if there is a file or not…
Ideas?
My powerShell function below
function uiPath_odata_TestCaseExecutions {
Param
(
$StartDateTime,
$EndDateTime,
$OrganizationUnitId
)
$Method = "GET"
$StartDateTime = $StartDateTime.AddSeconds(2); ##bug on the API "greater then" includes the same second.
[string]$str_StartTime = $StartDateTime.ToString('yyyy-MM-ddTHH:mm:ss.fffZ')
[string]$str_EndTime = $EndDateTime.ToString('yyyy-MM-ddTHH:mm:ss.fffZ')
$filter = "((StartTime gt $str_StartTime) and (EndTime le $str_EndTime))"
$select = "TestCaseId, ReleaseVersionId, VersionNumber, EntryPointPath, HasAssertions, StartTime, EndTime, Status"
Write-Host "filter: $filter"
Write-Host "select: $select"
######$uri = "$global:uiPathBaseUrl/odata/TestCaseExecutions?`$filter=$filter&`$expand=TestCaseAssertions&`$select=$select"
$uri = "$global:uiPathBaseUrl/odata/TestCaseExecutions?`$filter=$filter&`$expand=TestCaseAssertions,TestCaseExecutionAttachments"
$uri = [uri]::EscapeUriString($uri)
write-host $uri
$headers = @{}
$headers.Add('Authorization',"Bearer $global:bearer_token")
$headers.Add('X-UIPATH-OrganizationUnitId',$OrganizationUnitId)
$httpsResult = Invoke-WebRequest -Uri $uri -Headers $headers -Method $Method -ContentType "application/json" -TimeoutSec 180 -ErrorAction:Stop
if ($httpsResult.StatusCode -ne 200) {
$myerror = 'Function {0} failed ' -f $MyInvocation.MyCommand
$myerror = $myerror + "with Status code: " + $httpsResult.StatusCode
throw $myerror
}
$json = $httpsResult.Content | ConvertFrom-Json
return $json.value
}