I have a Pester Script with is running a few smoke tests for my API. When I run the Invoke-Pester, I get the Logo and the tests run fine. However at the end of the log I get Tests Passed: 0, Failed: 0, Skipped: 0, Pending: 0, Inconclusive: 0 and when I try to output as a NUnitXML there are not results in there either
Command:
Invoke-Pester -Script @{Path = 'Path\testscript.ps1'; Arguments = '200', 'application/json; charset=utf-8'} -OutputFormat NUnitXml -OutputFile ".\TestsResults.xml" Script:
param( [string]$HttpCode, [string]$ContentType ) Import-Module Pester -Force Describe 'API Smoke Tests' { Context "Direct Endpoint Smoke Test: $Uri" { It 'HTTP Code Should be equal to "200"' { $HttpCode | Should -Be 200 } It 'Content Type Should be equal to "application/json; charset=utf-8"' { $ContentType | Should -Be "application/json; charset=utf-8" } } } Console Log:
____ __ / __ \___ _____/ /____ _____ / /_/ / _ \/ ___/ __/ _ \/ ___/ / ____/ __(__ ) /_/ __/ / /_/ \___/____/\__/\___/_/ Pester v4.9.0 Executing all tests in 'Path\testscript.ps1' Executing script Path\testscript.ps1 Describing API Smoke Tests Context Direct Endpoint Smoke Test: [+] HTTP Code Should be equal to "200" 10ms [+] Content Type Should be equal to "application/json; charset=utf-8" 6ms Tests completed in 1.59s Tests Passed: 0, Failed: 0, Skipped: 0, Pending: 0, Inconclusive: 0