I am writing unit tests for my Powershell Modules, with a file for each module, and Describe
blocks for each function. Context
blocks organize the tests along the behavior I am trying to test for with some arrange code, and my It
blocks contain minimal arrange/act code and a assert.
I can limit my tests to only run a single test file by using Invoke-Pester "Path/To/Module"
I can also limit based on the Describe
blocks by using Invoke-Pester "Path/To/Module" -TestName @("RunThisDescribe","AndRunThisDescribe")
As I am adding a new assertion (via a new It
block) to an existing file
/Describe
/Context
, I want to test/debug my new assertion alone, without the rest of the assertions of a given describe/context running (but with any mocks/variables that I set at the describe/context scope still available.
I have been commenting out my existing assertions while I am developing the new one, then remove the block comments and run them all after I am finished with the new test. This works, but is clunky.
Is there a way to run Invoke-Pester
to only execute a given list of It
s?
Is there a better workflow for developing/debuging new tests other than either letting all of them run or commenting them out?
Context
blocks will be supported in the upcoming version 5 (which is in the alpha stage as of this writing). – Developer