PowerShell/test/powershell
Mark Kraus f41461825a Replace httpbin.org/get tests With WebListener (#4738)
* Adds the /Get/ functionality to Weblistener
* Replaces the tests that rely on httpbin.org/get with WebListener


* [Feature] Move HttpBin/Get Tests to WebListener

* [Feature] update .spelling

* [Feature] Address PR Feedback

* [Feature] Add and document Home & /

* Readme Update

* [Feature] Should Match -> Should Be

Rerun CI

* [Feature] Rebase and Rerun CI
2017-09-08 07:53:04 +04:00
..
engine Push locals of automatic variables to 'DottedScopes' when dotting script cmdlets (#4709) 2017-09-06 10:25:33 -07:00
Host Removed double spaces from .cs and .ps1 files (#4743) 2017-09-04 19:45:51 -07:00
Installer Set Redist test pending to unblock daily build failure (#4729) 2017-09-01 11:53:17 -07:00
Language Rename $IsOSX to $IsMacOS (#4757) 2017-09-07 10:34:40 -07:00
Modules Replace httpbin.org/get tests With WebListener (#4738) 2017-09-08 07:53:04 +04:00
Provider Updated tags of automounted drives tests (#3290) 2017-03-08 16:34:39 -08:00
SDK Change positional parameter for powershell.exe from -Command to -File (#4019) 2017-06-19 12:17:56 -07:00
README.md Rename $IsOSX to $IsMacOS (#4757) 2017-09-07 10:34:40 -07: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 $IsMacOS) { ... }

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.