PowerShell7/test/powershell
2017-03-22 12:43:38 -07:00
..
Common Fix for duplicate types in TypeTable (#3141) 2017-02-16 16:28:29 -08:00
engine Changed usage of registry to psdrive instead of type which causes failure on Linux (#3377) 2017-03-21 10:04:46 -07:00
Host tab expansion not working correctly for some parameters (#3364) 2017-03-21 08:23:51 -07:00
Language Search the assembly cache kept by ExecutionContext for type resolution. (#3327) 2017-03-17 13:19:31 -07:00
Modules Remove Archive tests 2017-03-22 12:43:38 -07:00
Provider Updated tags of automounted drives tests (#3290) 2017-03-08 16:34:39 -08:00
SDK Remove trailing whitespace (#3001) 2017-01-16 13:31:14 -08: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.