PesterForge

Quick start.

PesterForge reads a PowerShell function and writes the Pester test file for it. This page walks the loop once: install, import, generate a test for one of your functions, run it, then audit the whole module for what still has no tests.

01 Install Coming soon

PesterForge is not on the PowerShell Gallery yet. When the listing goes live (the changelog will say so), installing is the one line you already know:

Install-Module PesterForge

Until then there is no public download. [NEEDS KEITH: how someone should get PesterForge today, ahead of the Gallery listing. The repository is private and the site has no download link to offer.] Everything below matches the module as it exists today. PesterForge needs PowerShell 5.1 or later.

02 Import
Import-Module PesterForge

Four commands load with the module. Each answers to two names, a plain-English one and the original Pf-prefixed one; both always work, and this page uses the plain-English names.

New-PesterTestsReads a script or function file and writes a ready-to-run Pester test file for it
Measure-FunctionTestabilityReports one function's parameters, outputs, error handling, and how testable it is
Get-PesterCoverageChecks a module and reports which functions have Pester tests and which do not
New-PfTestFileWrites a test file for a function you have already profiled

Two more commands, Start-TestRun and New-TestProject, live in the module’s Tools folder and load by dot-sourcing (step 4 shows how). Get-Help about_PesterForge prints the whole command map.

03 Generate your first test file

Point New-PesterTests at a function file. It reads the code without running it, learns the parameters, the outputs, and the error paths, then writes a complete test file: static checks, unit tests, and integration and acceptance placeholders for you to fill in.

New-PesterTests -ScriptPath .\Public\Get-Widget.ps1 `
                -OutputPath .\Tests\Unit\Get-Widget.Tests.ps1

A result object comes back. The field names below are the real ones; the values are illustrative, not a captured run, and DecisionLog is trimmed here for width.

Status           : Succeeded
Outcome          : Generated test file for: Get-Widget
ErrorCategory    : None
OutputPath       : .\Tests\Unit\Get-Widget.Tests.ps1
BytesWritten     : 9184
DecisionLog      : {...}
AiEnriched       : False
AiOutcome        : NotAttempted
ConventionSource : None
04 Run it

The generated file is standard Pester. Run it the way you run any other test:

Invoke-Pester .\Tests\Unit\Get-Widget.Tests.ps1

You get Pester’s normal summary; the counts here are illustrative. Placeholders you have not filled in yet report as skipped rather than passing.

Tests completed in 3.42s
Tests Passed: 18, Failed: 0, Skipped: 4 NotRun: 0

For a whole project there is also Start-TestRun. It is a Tools script rather than a module export, so dot-source it first, from the folder PesterForge is installed in:

. .\Tools\Invoke-PfPester.ps1
Start-TestRun -ProjectRoot . -Category Unit

-Category accepts Static, Unit, Integration, Acceptance, or All. The default is All.

05 Audit the rest of the module

One function down. To see where the rest of the module stands:

Get-PesterCoverage -ModuleRoot .

The Outcome line below shows the command’s real message format; the numbers are illustrative.

Status         : Succeeded
Outcome        : Audited 23 functions (Layout=Suite): 15 covered, 8 missing
ErrorCategory  : None
TotalFunctions : 23
CoveredCount   : 15
MissingCount   : 8

The Results array names every function and whether a test file exists for it, so the missing eight become a work list you can feed back to step 3. Layout is auto-detected: Public and Private folders beside the manifest, ModuleBuilder-style nesting, or a custom layout you name with explicit -PublicPath, -PrivatePath, and -TestsPath.

Next

Each command here takes more parameters than this page shows: AI enrichment, project convention files, and a confidence check that runs the generated test against your function before handing it back. The features page has the full command reference, and Get-Help New-PesterTests -Full covers the same ground offline.