This directory contains the Pester tests to run for the module. We use Pester as it is the unofficial standard for PowerShell unit testing. Test stubs for custom cmdlets (created in ../custom
) will be generated into this folder when build-module.ps1
is ran. These test stubs will fail automatically, to indicate that tests should be written for custom cmdlets.
- Modifiable: yes
- Generated: partial
- Committed: yes
- Packaged: no
We allow three testing modes: live, record, and playback. These can be selected using the -Live
, -Record
, and -Playback
switches respectively on the test-module.ps1
script. This script will run through any .Tests.ps1
scripts in the test
folder. If you choose the record mode, it will create a .Recording.json
file of the REST calls between the client and server. Then, when you choose playback mode, it will use the .Recording.json
file to mock the communication between server and client. The live mode runs the same as the record mode; however, it doesn't create the .Recording.json
file.
Custom cmdlets generally encompass additional functionality not described in the REST specification, or combines functionality generated from the REST spec. To validate this functionality continues to operate as intended, creating tests that can be ran and re-ran against custom cmdlets is part of the framework.
To execute tests, run the test-module.ps1
. To write tests, this example from the Pester repository is very useful for getting started.