PowerShell/test/powershell
Sergei Vorobev 81a598f242 Merge pull request #2089 from 0xfeeddeadbeef/master
Use prefixed QNames in XPath expressions used by all implementations of ICmdletProviderSupportsHelp interface
2016-09-13 15:14:46 -07:00
..
Common address some review feedback 2016-08-30 16:15:10 -07:00
engine Make sure we log that tests for Cert:\ and WSMan:\ provider-specific help are skipped 2016-09-13 10:26:53 +04:00
enginecore Merge pull request #2063 from jsoref/spelling-test 2016-08-31 14:13:49 -07:00
Host Fix for Linux remote script debugging hang (#2213) 2016-09-13 11:31:48 -07:00
Language Added tests for hashtabletoPSCustomObjectConversion, OutErrorVairable tests (#2160) 2016-09-12 18:29:55 -07:00
Modules Merge pull request #2046 from xiaoyinl/use-https-links 2016-09-01 17:23:09 -07:00
Scripting/NativeExecution Add tests for Error stream 2016-08-01 18:40:51 -07:00
SDK make sure that all tests are using the proper $IsCoreCLR variable instead of $IsCore 2016-07-27 12:32:17 -07:00
README.md Correct link to Pester Do and Don't document 2016-08-19 11:29:50 -05:00

Pester Testing Test Guide

Also see the Pester Do and Don't 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.