![]() We decided to add support for an optional -Credential param, for cases in which we would need to use a different account. Missed commands: File Function Line Command - Add-ProtectedGroup Add-ProtectedGrou 6 if ( $GroupName -eq 'SpecialAdmins' ) PESTER FRAMEWORK CODE\\Add-ProtectedGroupMember.ps1 Code coverage report: Covered 0.00 % of 5 analyzed commands in 1 file. For instance, here’s a small piece of pseudo code, which would more or less add a user to a group in AD. It wasn’t until I learned about the powerful -CodeCoverage parameter of Pester that it actually clipped. It’s meant to test the internal logic of your code, so that you can develop with certainty that new features to your function don’t break your cmdlet. ![]() See, Pester is a Unit Driven Test Framework. In truth, all of the tests I wrote earlier on were actually integration tests. But I was only looking at the outside of my code, or where it integrates into the environment. You’d write a ‘It should make a box’ test and wire it up before you actually wrote the New-Box function. ![]() I always thought ‘Why do I need to test my code? I know it works if it accomplishes the job it’s supposed to do’.įor instance, I understood that Pester was a part of test-driven development, a paradigm in which you start by writing tests before you write any code. ![]() To tell the truth, I didn’t understand the purpose of Pester. Why is this a recent thing, you may ask? After all, I was at PowerShell Summit and heard the good word about it from Dave Wyatt himself way back in 2015, I’ve had years to start doing this. Recently at work I have finally seen the light and begun adding Pester tests to my modules. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |