Run Pester tests in PowerShell ISE with IsePester

Today I stumbled upon a package in chocolatey that I wasn’t aware of. It’s called IsePester from @dfinke. If you develop you PowerShell scripts with ISE and run Pester tests this is a really nice package.

If you haven’t played around with chocolatey – do it. It’s a really need packaging manger that makes setting up your dev machines really easy. To install chocolatey just run the following command in PowerShell:

iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

To use Pester you have to install it. If it is already installed you can override it with -–force / -f

choco Install Pester -y -f 

Install IsePester the same way…

choco Install IsePester -y 

image

If you now restart your PowerShell ISE you can see under Add-Ons Pester und you can invoke it with the shortcut Crtl+F5. The cool thing is, that this is not only possible inside the test file but also inside your script (this only works if you adhere to pester naming conventions). So if you are now writing your script you can execute the scripts without leaving your editor… Nice

image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s