PowerShell/test/powershell
Staffan Gustafsson f959c41e71 Add Hashtable tab completion for -Property of select-object (#3625)
Also added more tab completion tests.
2017-04-24 16:45:05 -07:00
..
Common Autoload TestRemoting.psm1 (#3430) 2017-03-29 10:11:02 -07:00
engine Improve ValidateCount attribute error message (#3596) 2017-04-21 18:01:04 -07:00
Host Add Hashtable tab completion for -Property of select-object (#3625) 2017-04-24 16:45:05 -07:00
Language Add ErrorMessage property to ValidatePattern, ValidateSet and ValidateScript attributes (#2728) 2017-04-20 11:31:57 -07:00
Modules Use more accurate test to check if source and destination paths are pointing the same file (#3441) 2017-04-21 16:09:53 -07:00
Provider Updated tags of automounted drives tests (#3290) 2017-03-08 16:34:39 -08:00
SDK Migrate from project.json to MSBuild (#3398) 2017-03-23 13:04:52 -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.