You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

TestCenter_2.ps1 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <#
  2. .SYNOPSIS
  3. Get test suite results
  4. .DESCRIPTION
  5. Retrieve test suite results and format for output
  6. .PARAMETER TestRunID
  7. ID of the test suite execution to poll
  8. .EXAMPLE
  9. > .\New-AkaUTests.ps1 -TestID 12345
  10. #>
  11. Param(
  12. [Parameter(Mandatory)]
  13. [string]
  14. $TestRunID,
  15. [Parameter()]
  16. [string]
  17. $EdgeRCFile,
  18. [Parameter()]
  19. [string]
  20. $Section,
  21. [Parameter()]
  22. [string]
  23. $AccountSwitchKey
  24. )
  25. $CommonParams = @{
  26. EdgeRCFile = $EdgeRCFile
  27. Section = $Section
  28. AccountSwitchKey = $AccountSwitchKey
  29. }
  30. $Results = Invoke-AkamaiRestMethod -Path "/test-management/v3/test-runs/$TestRunID" @CommonParams
  31. if ($Results.functional.testSuiteExecutions[0].status -eq 'IN_PROGRESS') {
  32. Write-Host -ForegroundColor Yellow "Tests are not yet complete. Please wait and try again"
  33. return
  34. }
  35. $TestResults = $Results.functional.testSuiteExecutions.testCaseExecutions
  36. $Spaces = ' '
  37. foreach ($TestResult in $TestResults) {
  38. $Method = $TestResult.testCaseContext.testRequest.requestMethod
  39. $URL = $TestResult.testCaseContext.testRequest.testRequestUrlResolved
  40. $Condition = $TestResult.testCaseContext.condition.conditionExpression
  41. $Result = $TestResult.conditionEvaluationResult.result
  42. $SpaceLength = 80 - $Condition.length
  43. $ScopedSpaces = $Spaces.SubString(0, $SpaceLength)
  44. Write-Host -ForegroundColor Blue $Method -NoNewline
  45. Write-Host "`t" -NoNewline
  46. Write-Host $URL
  47. Write-Host "`t$Condition" -NoNewline
  48. if ($Result -eq 'PASSED') {
  49. Write-Host -ForegroundColor Green "$ScopedSpaces$Result"
  50. }
  51. else {
  52. Write-Host -ForegroundColor Red "$ScopedSpaces$Result"
  53. }
  54. }