Pester: New-Fixture

While I might not always use it, when you’ve been away for a while and forgotten syntax, New-Fixture scaffolds up a PowerShell script (the script under test – SUT), and a PowerShell pester script to test the SUT. The wiki is very good and is here.

I don’t like the idea of having the test and production script in the same folder, but that is easy enough to adjust (see posts passim).




PowerShell – convert delimited record to object

Spent sometime struggling with this, so worth recording. Test. Code.


Pester: pretty summaries

Short examples of a mix of passing and failing Pester tests being rendered in a browser, using ReportUnit, available on NuGet, and ingesting NUnit output format. Check out the browser screenshots below first for the end result.


# Runs all test suites, passes the output to the NUnit format, renders it, displays in a browser

# see my article here for installing nuget via Choco:



nuget.exe install ReportUnit

#Then, for example...

# Execute all the tests

$outputName = Get-Random

$outputFile = "$PSScriptRoot/$outputName.xml"

$htmlFile = "$PSScriptRoot/$outputName.html"

Invoke-Pester -PassThru -Strict -OutputFile $outputFile -OutputFormat NUnitXml

.\ReportUnit.1.2.1\tools\ReportUnit.exe $outputFile

Start-Process chrome $htmlFile

PowerShell: proving case insensitivity with Pester

PowerShell, as any fule doth know, is case-insensitive by default. However, I saw this kind of construct the other day:

if ($value -eq "Y" -or $value -eq "y") { ...

Oh dear. But just to prove the point, and as Pester is now Out of the Box on Windows 10: