PowerShell/test/powershell
Ilya e00161a8af Add autoload for TestLanguage.psm1 TestHelpers.psm1 (#3456)
* Add autoload for TestHelpers.psm1

Test.Helpers.psm1 was renamed to TestHelpers.psm1

* Resolve conflit and rebase Add autoload for TestLanguage.psm1

* Remove unneeded comments from PSD1 files

* Rename test modules

Remove approved verbs (Get-Verb) from module names.

* Enhance ShouldBeErrorId to output exception into pipeline for later analysis

* Remove unneeded comments

* Resolve merge conflict
2017-05-17 11:09:27 -07:00
..
Common Add autoload for TestLanguage.psm1 TestHelpers.psm1 (#3456) 2017-05-17 11:09:27 -07:00
engine Add autoload for TestLanguage.psm1 TestHelpers.psm1 (#3456) 2017-05-17 11:09:27 -07:00
Host Use '<id> - <name>' as ToolTip and ListItemText when tab completing process ID (#3664) 2017-05-05 18:05:21 -07:00
Language Add autoload for TestLanguage.psm1 TestHelpers.psm1 (#3456) 2017-05-17 11:09:27 -07:00
Modules Add autoload for TestLanguage.psm1 TestHelpers.psm1 (#3456) 2017-05-17 11:09:27 -07:00
Provider Updated tags of automounted drives tests (#3290) 2017-03-08 16:34:39 -08:00
SDK Migrate from project.json to MSBuild (#3398) 2017-03-23 13:04:52 -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.