Published in Articles on by Michiel van Oosterhout ~ 2 min read

PowerShell is a full-featured programming language, documented by Microsoft in a set of 'About topics'. But you may find this documentation lacking in some areas. For example, the documentation for the [Parameter()] attribute's Mandatory argument gets 4 sentences in the about_Functions_Advanced_Parameters topic. You can find other documentation (for example here and here), but a lot of details are still missing. You may be left wondering still: which types of error does this attribute raise? Or how does this attribute interact with other attributes, such as [AllowNull()]?

There is currently no official online 'playground' for PowerShell, but of course you could switch to the terminal to write some test code. But a command line is not the best place to author functions or cmdlets, and the code is gone when you close the terminal. So at some point you find yourself in my current position, where you have collected lots of code snippets that each answer small questions like the ones raised above.

I decided to publish these on Azure DevOps, in the form of Pester tests, so that the tests results can function as 'live' documentation. I chose Azure DevOps over GitHub because Azure DevOps pipeline run have a built-in tab to browse test results.

Pester test results as 'live' PowerShell documentation
Pester test results as 'live' PowerShell documentation

The tests are run using a matrix strategy so that differences in behavior between PowerShell editions can be observed.

So go here for the Git repository, and clone it to run the tests locally (there is a Visual Studio Code task), or go here to browse the pipeline runs containing the test results. I am using a public project in my personal Azure DevOps organisation for this.