PowerShell/test/powershell
xiaoyinl f538eeb416 Use HTTPS links for go.microsoft.com
I replace all occurrences of http://go.microsoft.com with https://go.microsoft.com in text files.
2016-08-23 21:21:31 -04:00
..
Common Create new test for Get-Credential which requires module to create a test host 2016-08-19 13:01:04 -07:00
engine Use HTTPS links for go.microsoft.com 2016-08-23 21:21:31 -04:00
enginecore Merge pull request #1337 from PowerShell/TestGetCommand 2016-08-12 11:41:02 -07:00
Host Address review comments in test code 2016-08-12 11:01:46 -07:00
Language Fix the test that fails in Travis CI build (#1792) 2016-08-12 18:36:16 -07:00
Modules Use HTTPS links for go.microsoft.com 2016-08-23 21:21:31 -04: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.