Assertions

Pester comes with support for a variety of assertion types. These assertion types are exposed as parameters for Should. Several of these assertion types grant access to additional parameters. These assertions are, for the most part, similar to PowerShell's comparison operators.

Details of the available assertions are available on the Pester wiki, under the description for Should, at https://github.com/pester/Pester/wiki/Should.

Assertions are most frequently used to test the actions and output of the subject of a test. The simplest of these, -Be, was used in the examples for Get-SquareRoot. The -Be assertion is the equivalent of the -eq comparison operator, with one difference: -Be can compare arrays for equality.

Testing for the errors raised by a command is one of the more advanced testing cases.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
13.59.100.205