PowerShell/test/powershell
James Truher [MSFT] 9aa693dfb3 Jameswtruher/travisdaily2 (#2842)
* Assign $ProgressPreference = "SilentlyContinue" to reduce output size

Travis is still complaining that the log file is too big, eliminating progress is
another step to reducing output. It's also not needed for our CI environment.

* Removed white space at end of lines

* fix misplacement of progress preference setting

also fix up trailing whitespace
2016-12-06 13:58:57 -08:00
..
Common Refactor implicit remoting tests to work in CI 2016-10-28 16:51:44 -07:00
engine Jameswtruher/travisdaily2 (#2842) 2016-12-06 13:58:57 -08:00
Host Re-shuffle minishell tests 2016-11-15 14:49:39 -08:00
Language Marked flaky test as pending to unblock daily builds (#2838) 2016-12-04 00:12:51 -08:00
Modules Jameswtruher/travisdaily2 (#2842) 2016-12-06 13:58:57 -08:00
Provider Move tests to more appropriate places now that we have the directory structure defined 2016-09-28 14:57:50 -07:00
SDK Replace 'git rev-parse' with path relative to '$PSScriptRoot' in powershell tests 2016-10-28 16:51:44 -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.