Pester Test

Sara 401 Reputation points

I am trying to write a pester test for the following function,can someone help me on walk through me on few steps below,

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,275 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rich Matheisen 43,931 Reputation points

    Pester isn't that hard to learn. Search for "Pester tutorial" and you'll find more than a few items that are helpful. If you prefer a book, there's the "Pester Book" by Adam Bertram (I used it and found it to easy to understand and got into writing tests for modules within a day or two).

    Posting the function's code isn't very helpful. You should really start by writing a few basic Pester tests and add more as you build the function. If you don't know what the function should be returning when given a set of parameters (in all possible combinations, including omitting parameters, and parameters that contain unexpected values) then you're "flying blind".

    Once you built a set of tests and your function works as expected (as defined by the tests!), you can rerun the tests after making any changes to your code to verify that you haven't mistakenly altered the output!

    0 comments No comments

0 additional answers

Sort by: Most helpful