<# .SYNOPSIS Get test suite results .DESCRIPTION Retrieve test suite results and format for output .PARAMETER TestRunID ID of the test suite execution to poll .EXAMPLE > .\New-AkaUTests.ps1 -TestID 12345 #> Param( [Parameter(Mandatory)] [string] $TestRunID, [Parameter()] [string] $EdgeRCFile, [Parameter()] [string] $Section, [Parameter()] [string] $AccountSwitchKey ) $CommonParams = @{ EdgeRCFile = $EdgeRCFile Section = $Section AccountSwitchKey = $AccountSwitchKey } $Results = Invoke-AkamaiRestMethod -Path "/test-management/v3/test-runs/$TestRunID" @CommonParams if ($Results.functional.testSuiteExecutions[0].status -eq 'IN_PROGRESS') { Write-Host -ForegroundColor Yellow "Tests are not yet complete. Please wait and try again" return } $TestResults = $Results.functional.testSuiteExecutions.testCaseExecutions $Spaces = ' ' foreach ($TestResult in $TestResults) { $Method = $TestResult.testCaseContext.testRequest.requestMethod $URL = $TestResult.testCaseContext.testRequest.testRequestUrlResolved $Condition = $TestResult.testCaseContext.condition.conditionExpression $Result = $TestResult.conditionEvaluationResult.result $SpaceLength = 80 - $Condition.length $ScopedSpaces = $Spaces.SubString(0, $SpaceLength) Write-Host -ForegroundColor Blue $Method -NoNewline Write-Host "`t" -NoNewline Write-Host $URL Write-Host "`t$Condition" -NoNewline if ($Result -eq 'PASSED') { Write-Host -ForegroundColor Green "$ScopedSpaces$Result" } else { Write-Host -ForegroundColor Red "$ScopedSpaces$Result" } }