[ Web Proxy ]
URL:
Viewing: https://pester.dev [Back]  [Original]

Pester - The test and mock framework for PowerShell | Pester
Skip to main content
Open sourceCross-platformPowerShell 5.1 & 7.4+

Test your PowerShell.
Ship with confidence.

Pester is the ubiquitous test and mock framework for PowerShell expressive syntax, powerful mocking and beautiful output, everywhere PowerShell runs.

PS>Install-Module PesterCopy
WindowsLinuxmacOSAzure PipelinesGitHub Actions

Two ways to start

Read the short version, or build a module from scratch and test it as you go.

About 5 minutes

Quick Start

The short version. Install Pester, write one test file, run it, and see what a failure looks like.

  • Install and import Pester
  • Write and run your first test
  • Read the failure output
Read the Quick Start
Seven parts, at your own pace

Follow-along tutorial

Start with an empty folder and build a real PowerShell module, writing tests for each part as you add it.

  • Test public functions and private helpers
  • Mock a data source and isolate file operations
  • Measure code coverage and run it all in CI
Start the tutorial

Write your first test in seconds

Save a *.Tests.ps1 file, describe what your code should do, and run it. Pester handles discovery, execution and reporting.

Get-Planet.Tests.ps1
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.

Everything you need to test PowerShell

From a one-line assertion to validating entire environments Pester scales with you.

Readable, expressive syntax

Describe, Context, It and Should read like plain English. Tests document intent instead of hiding it in boilerplate.

Powerful mocking

Replace any command with a mock, control what it returns, and assert exactly how it was called no dependency injection required.

Built-in code coverage

See which lines your tests exercise and export JaCoCo or Cobertura reports your pipeline already understands.

Runs everywhere

PowerShell 7.4+ on Windows, Linux and macOS test the same code everywhere it runs.

First-class VS Code

Run and debug tests straight from the Test Explorer, jump to failures, and scaffold tests with snippets.

CI/CD ready

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.

Meet our sponsors

Pester is sustained by the great folks on OpenCollective and GitHub Sponsors. Become a financial contributor and help us keep it thriving.

Individual backers

Individual backers [Individual backers]

Organizations

Ready to write your first test?

Install Pester and go from zero to a green test in minutes.


Web Proxy Viewer  |  New URL  |  Original Page