PowerShell/test/powershell
Travis Plunk 06d416b954 Merge pull request #4353 from SteveL-MSFT/deviceguard-startprocess
Fix DeviceGuard data being returned from Get-ComputerInfo and Start-Process test failure
2017-07-28 14:22:51 -07:00
..
Common Add autoload for TestLanguage.psm1 TestHelpers.psm1 (#3456) 2017-05-17 11:09:27 -07:00
engine Fix error message when 'HelpMessage' property of 'ParameterAttribute' is set to empty string (#4334) 2017-07-26 09:20:43 -07:00
Host Due to the use of unsupported APIs, we must remove the Counter CmdLets in the Diagnostics Module until a better solution is found. (#4303) 2017-07-19 17:20:01 -07:00
Language Fix array expression to not return null or throw error (#4296) 2017-07-24 21:52:30 -07:00
Modules Merge pull request #4353 from SteveL-MSFT/deviceguard-startprocess 2017-07-28 14:22:51 -07: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 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.