diff --git a/Examples/TestRestAPI/ShowPesterResults.ps1 b/Examples/TestRestAPI/ShowPesterResults.ps1 index f66558b..aa3b7ba 100644 --- a/Examples/TestRestAPI/ShowPesterResults.ps1 +++ b/Examples/TestRestAPI/ShowPesterResults.ps1 @@ -1,40 +1,32 @@ function Show-PesterResults { - $xlfilename=".\test.xlsx" - rm $xlfilename -ErrorAction Ignore + $xlfilename = ".\test.xlsx" + Remove-Item $xlfilename -ErrorAction Ignore $ConditionalText = @() $ConditionalText += New-ConditionalText -Range "Result" -Text failed -BackgroundColor red -ConditionalTextColor black $ConditionalText += New-ConditionalText -Range "Result" -Text passed -BackgroundColor green -ConditionalTextColor black $ConditionalText += New-ConditionalText -Range "Result" -Text pending -BackgroundColor gray -ConditionalTextColor black - + $xlParams = @{ - Path=$xlfilename - WorkSheetname = 'PesterTests' - ConditionalText=$ConditionalText - PivotRows = 'Description' - PivotColumns = 'Result' - PivotData = @{'Result'='Count'} - IncludePivotTable = $true - #IncludePivotChart = $true - #NoLegend = $true - #ShowPercent = $true - #ShowCategory = $true - AutoSize = $true - AutoNameRange = $true - AutoFilter = $true - Show = $true + Path = $xlfilename + WorkSheetname = 'PesterTests' + ConditionalText = $ConditionalText + PivotRows = 'Result', 'Name' + PivotData = @{'Result' = 'Count'} + IncludePivotTable = $true + AutoSize = $true + AutoNameRange = $true + AutoFilter = $true + Show = $true } - $(foreach($result in (Invoke-Pester -PassThru -Show None).TestResult) { - - [PSCustomObject]@{ - Description = $result.Describe - Name = $result.Name - #Time = $result.Time - Result = $result.Result - Messge = $result.FailureMessage - StackTrace = $result.StackTrace - } - - }) | Sort Description | Export-Excel @xlParams + $(foreach ($result in (Invoke-Pester -PassThru -Show None).TestResult) { + [PSCustomObject]@{ + Description = $result.Describe + Name = $result.Name + Result = $result.Result + Messge = $result.FailureMessage + StackTrace = $result.StackTrace + } + }) | Sort-Object Description | Export-Excel @xlParams } \ No newline at end of file diff --git a/Examples/TestRestAPI/TestAPIReadXls.ps1 b/Examples/TestRestAPI/TestAPIReadXls.ps1 index 2e9358d..ff2e5d3 100644 --- a/Examples/TestRestAPI/TestAPIReadXls.ps1 +++ b/Examples/TestRestAPI/TestAPIReadXls.ps1 @@ -1,5 +1,3 @@ -try {. $PSScriptRoot\..\..\LoadPSD1.ps1} catch {} - function Test-APIReadXls { param( [parameter(Mandatory)] @@ -7,7 +5,7 @@ function Test-APIReadXls { $WorksheetName = 'Sheet1' ) - $testFileName = "{0}.tests.ps1" -f (get-date).ToString("yyyyMMddHHmmss.fff") + $testFileName = "{0}.tests.ps1" -f (get-date).ToString("yyyyMMddHHmmss") $records = Import-Excel $XlFilename @@ -37,7 +35,6 @@ function Test-APIReadXls { "@ }) - @" Describe "Tests from $($XlFilename) in $($WorksheetName)" { $($blocks) diff --git a/Examples/TestRestAPI/testlist.xlsx b/Examples/TestRestAPI/testlist.xlsx index 8cfe778..b6daf82 100644 Binary files a/Examples/TestRestAPI/testlist.xlsx and b/Examples/TestRestAPI/testlist.xlsx differ