You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A common best practice for Pester tests seems to be to encapsulate Pester tests in a Try-Finally construct.
Since a Finally block is always run, this allows for a cleanup of the environment, independent of the Try block outcome.
As a reference, have a look at the Pester Unit and Integration test templates that MSFT provides in their DSCResources repo.
Yes, this would help in our case because we have defined the BeforeAllTests and AfterAllTests functions and with this we can call BeforeAllTests in the beginning of the try block and AfterAllTests in the Finally block.
A common best practice for Pester tests seems to be to encapsulate Pester tests in a Try-Finally construct.
Since a Finally block is always run, this allows for a cleanup of the environment, independent of the Try block outcome.
As a reference, have a look at the Pester Unit and Integration test templates that MSFT provides in their DSCResources repo.
The general layout:
The text was updated successfully, but these errors were encountered: