PowerShell/test/powershell
2017-01-12 14:25:07 -08:00
..
Common Rename Wait-CompleteExecution to Wait-UntilTrue 2017-01-12 14:25:07 -08:00
engine Jameswtruher/travisdailybuild (#2958) 2017-01-10 14:42:27 -08:00
Host Fix type completion w/ type aliases (accelerators) (#2533) 2016-12-21 15:33:05 -08:00
Language Rename Wait-CompleteExecution to Wait-UntilTrue 2017-01-12 14:25:07 -08:00
Modules Remove -Force from Import-Module in tests 2017-01-12 14:25:07 -08:00
Provider Move tests to more appropriate places now that we have the directory structure defined 2016-09-28 14:57:50 -07:00
SDK Replace 'git rev-parse' with path relative to '$PSScriptRoot' in powershell tests 2016-10-28 16:51:44 -07:00
README.md Fixed broken link in README (#2643) 2016-11-08 10:22:26 -08:00

Pester Testing Test Guide

Also see the Writing Pester Tests document.

Running Pester Tests

Go to the top level of the PowerShell repository and run: Start-PSPester inside a self-hosted copy of PowerShell.

You can use Start-PSPester -Tests SomeTestSuite* to limit the tests run.

Testing new powershell processes

Any launch of a new powershell process must include -noprofile so that modified user and system profiles do not causes tests to fail. You also must take care to call the development copy of PowerShell, which is not the first one on the path.

Example:

    $powershell = Join-Path -Path $PsHome -ChildPath "powershell"
    & $powershell -noprofile -command "ExampleCommand" | Should Be "ExampleOutput"

Portability

Some tests simply must be tied to certain platforms. Use Pester's -Skip directive on an It statement to do this. For instance to run the test only on Windows:

It "Should do something on Windows" -Skip:($IsLinux -Or $IsOSX) { ... }

Or only on Linux and OS X:

It "Should do something on Linux" -Skip:$IsWindows { ... }

Pending

When writing a test that should pass, but does not, please do not skip or delete the test, but use It "Should Pass" -Pending to mark the test as pending, and file an issue on GitHub.