Skip to content

Pester Tests

Alan Renouf edited this page Nov 10, 2016 · 2 revisions

#How to run Pester Tests

To use Pester to run tests against your environment to ensure the PowerCLI code is working, use the following steps:

  1. Download or clone this repository to your local machine
  2. Unzip if necessary
  3. Launch PowerShell or PowerCLI and CD into the Pester folder
  4. Run the following code replacing the details for your VC

Invoke-Pester -Script @{ Path = '.\*.ps1'; Parameters = @{ VCNAME="VC01.local"; VCUSER="[email protected]"; VCPASS="Admin!23"} }

The below is an example of how to run a test using PowerCLI Core:

docker run --rm -it \                                               
  -v ~/Dropbox/VMware/PowerCLI-Example-Scripts:/tmp/scripts vmware/powerclicore powershell 'Invoke-Pester -Script @{ Path = "/tmp/scripts/Pester/Test Connection to VC.ps1"; Parameters = @{ VCNAME="10.160.78.212"; VCUSER="[email protected]"; VCPASS="Admin!23"} }'
Clone this wiki locally