PowerShell/test/powershell
James Truher 0a18a46281 Update json tests to be more cross-plat and handle multiple invocations
only create the enumtest type if it doesn't exist
don't try to compare line endings on json tests which contain arrays,
formatting of the output need not be validated
2016-08-02 12:05:24 -07:00
..
engine Add CI tag to SemanticVersion.Tests.ps1 2016-07-27 18:54:40 -07:00
enginecore Add Adapter Pester Unit Test 2016-08-02 00:31:27 -07:00
Host all tests are now marked with proper tag 2016-07-27 12:06:51 -07:00
Language Skip $input type test per #1563 2016-07-28 18:02:24 -07:00
Modules Update json tests to be more cross-plat and handle multiple invocations 2016-08-02 12:05:24 -07:00
Scripting/NativeExecution changes tags for tests 2016-07-27 12:06: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 Link Pester readme to Pester Do and Don't 2016-05-18 10:08:05 -07: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.