While it’s fairly simple to filter through Pester tests by their names with the
parameter, it’s not always a great way to limit a run of tests. I recently received a pull request
to improve the Vester project
with testing tags. Not realizing that this was a feature of Pester, I thought I’d share how it works. The idea is that each
block within a Pester test can have one or more tags applied to help make filtering tests much simpler and more effective.
Here’s a sample bit of code from the
Describe -Name 'Cluster Configuration: DRS Settings' -Tags @("vcenter","cluster")
Note that the test above can now be referenced with either the
tag. This can be done in two ways:
– use the
Tagparam to limit a run of Pester tests to a specific set of tags.
– use the
ExcludeTagparam to run all tests except for the ones with the specific set of tags.
Invoke-Pester .\Vester\Tests -Tag host -ExcludeTag nfs
will run tests with the
tag but skip tests with the
This was a great pull request and I am thrilled to learn more about Pester through the eyes of community contributions! The README file has been updated appropriately, too.