Pester is used to test PowerShell's scripts and functions. It can be used for the unit testing of templates as well.
Pester provides the necessary infrastructure to ease the process of writing unit tests in PowerShell. It provides facilities to write test cases, execute, and report back results. It is an open source utility available as a PowerShell module. By default, it is available in Windows Server 2016 and Windows 10. For other operating systems, it can be installed using the following:
Install-Module cmdlet
Writing unit tests using Pester is quite simple. It provides functions for declaring tests, as well as assertions. Assertions refer to the process of comparing and validating two variables. A simple Pester script in PowerShell is shown next. In this example, unit tests are written against a simple function that adds two numbers together.
Pester provides...