20 Pestering your script

Pester is a powerful tool for automating your testing in PowerShell scripts. As we transition into a DevOps-oriented world, it becomes crucial to ensure the reliability of your scripts. No one wants a broken script running in a production environment. Even if you test your script initially, modifications or unique conditions might arise that require retesting. This chapter will delve into automated unit testing for PowerShell scripts using Pester.

20.1 The vision

Here’s where we want to get you:

  1. You write some code or modify some old code.

  2. You check your code into a source control repository.

  3. The repository triggers a continuous integration pipeline. Usually incorporating third-party tools, the pipeline builds a ...

Get Learn PowerShell Scripting in a Month of Lunches, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.