Home Data Center Microsoft: Testing PowerShell with Pester

Microsoft: Testing PowerShell with Pester

0
Microsoft: Testing PowerShell with Pester
0

As PowerShell scripts become more and more important to organizations, simply eyeballing the results a few times and confirming that they do not return an error isn’t good enough. Especially if the PowerShell code you write is maintaining production systems, it’s critical that some extra steps are taken to run that script through many different scenarios to ensure it’s rock-solid. The way to do this is by creating Pester unit tests.

Pester is an open source unit testing framework developed specifically to test PowerShell code. It is a PowerShell module that is used to write tests for PowerShell code to confirm that what it does is what you expect. In a nutshell, Pester is the code that’s written “on top of” your code to act as quality assurance. Fortunately, Pester itself is written in PowerShell, so you don’t have to be a software developer to learn how to use it. As long as you can learn a few syntactical differences between vanilla PowerShell and Pester, you’ll be okay.

Note: Before we get too far here it’s important we clarify “tests.” In our case, we’re going to be focusing on unit tests. These kinds of tests differ from other types of tests you might hear thrown around like infrastructure, integration or acceptance tests. The primary difference is that unit tests test the code itself while the other kinds of tests test how that code interacts with the environment. If you’d like an example of infrastructure testing, check out my Infrastructure Testing with Pester talk.

Read the entire article here, Testing PowerShell with Pester – Microsoft MVP Award Program Blog

via the fine folks at Microsoft

Categories:
Microsoft Founded in 1975, Microsoft (Nasdaq “MSFT”) is the worldwide leader in software, services, devices and solutions that help people and businesses realize their full potential.

Featured Resources:

Related Articles:

| LATEST FEATURED RESOURCES

White Papers

    Application Lifecycle Management with Stratusphere UX – White Paper

    Enterprises today are faced with many challenges, and among those at the top of the list is the struggle surrounding the design, deployment, management and operations that support desktop applications. The demand for applications is increasing at an exponential rate, and organizations are being forced to consider platforms beyond physical, virtual and cloud-based environments. Users […]

    Downloads

      Download Commvault VM Backup and Recovery: end-to-end VM backup, recovery and cloud management

      Commvault’s ability to provide end-to-end VM backup, recovery and cloud management creates a significantly better way to build, protect and optimize VMs throughout their lifecycle. Our best-in-class software for VM backup, recovery and cloud management delivers a number of significant benefits, including: VM recovery with live recovery options; backup to and in the cloud; custom-fit […]

      On-Demand Webinars

        What’s Going on in EUC Printing – A Technical Deep Dive!

        The IGEL Community and ThinPrint invite you to watch the following technical deep dive webinar. The agenda is to technically bring you up to speed on what’s going on in the EUC Printing space today along with a deep dive into new methods, technologies, printing scenarios and a discussion on why printing still matters. You […]

        Latest Videos

          Views All IT News on DABCC.com
          Views All IT Videos on DABCC.com
          Win big $$, visit ITBaller.com for more info!

          Visit Our Sponsors

          Close