| [ Web Proxy ] |
| Viewing: https://pester.dev | [Back] [Original] |
Pester is the ubiquitous test and mock framework for PowerShell expressive syntax, powerful mocking and beautiful output, everywhere PowerShell runs.
PS>Install-Module PesterCopyRead the short version, or build a module from scratch and test it as you go.
The short version. Install Pester, write one test file, run it, and see what a failure looks like.
Start with an empty folder and build a real PowerShell module, writing tests for each part as you add it.
Save a *.Tests.ps1 file, describe what your code should do, and run it. Pester handles discovery, execution and reporting.
BeforeAll {
. $PSScriptRoot/Get-Planet.ps1
}
Describe 'Get-Planet' {
It 'lists all 8 planets' {
$planets = Get-Planet
$planets.Count | Should-Be 8
}
}
Green when it passes and a precise, readable diff the moment it doesn't.
From a one-line assertion to validating entire environments Pester scales with you.
Describe, Context, It and Should read like plain English. Tests document intent instead of hiding it in boilerplate.
Replace any command with a mock, control what it returns, and assert exactly how it was called no dependency injection required.
See which lines your tests exercise and export JaCoCo or Cobertura reports your pipeline already understands.
PowerShell 7.4+ on Windows, Linux and macOS test the same code everywhere it runs.
Run and debug tests straight from the Test Explorer, jump to failures, and scaffold tests with snippets.
Emit NUnit or JUnit results for GitHub Actions, Azure Pipelines, Jenkins and more. Fail the build when a test fails.
Pester is the standard test framework for PowerShell trusted by the PowerShell project itself and teams across the ecosystem, including Microsoft and Azure.
Logos are trademarks of their respective owners.
Pester is sustained by the great folks on OpenCollective and GitHub Sponsors. Become a financial contributor and help us keep it thriving.
Install Pester and go from zero to a green test in minutes.
| Web Proxy Viewer | New URL | Original Page |