Powershell in Windows 10 and Windows Server 2016 includes a module for Unit Testing called ‘Pester’. It is a framework for quickly running tests that can be user-defined and reporting results in various formats.
We have incorporated this framework into emdash, initially to run environment ‘healthchecks’ – to check that the servers, databases and services that are defined in an environment exist in the infrastructure.
If you are not running on Windows Server 2016 on the server running emdash, you will need to install the Pester powershell modules.
Powershell 5 and above
On servers that are running Powershell 5 and above, you can install the pester module as follows:
1. Open a Powershell ISE session as Administrator
2. Run this command:
Find-Module pester -Repository psgallery | Install-Module
3. You may be prompted with the following. If so, select ‘Yes to All
4. Check that ‘Invoke-Pester’ is now a valid command
Earlier Powershell Versions
If you are running an earlier version of Powershell, we recommend you update to Version 5.
However, if that is not possible, you can still install the Pester module onto you server, as follows:
1. Download the latest version of Pester from their GitHub page -- https://github.com/pester/Pester/releases
2. Unzip the folder, and copy the files to your Module directory. Your module directory is most likelyC:\Program Files\WindowsPowerShell\Modules\Pester
3. Open a Powershell ISE session and check the installation by typing ‘Invoke-Pester’. You should see output like this:
Troubleshooting
If you perform the above steps, but you still get a failure saying 'invoke-pester is not a valid command' you may also need to run the steps from a 32-bit Powershell session. This is often needed where emdash is running on a server that is Windows 2008R2.
If so, open 'Powershell ISE (x86)' as the administrator user and follow the steps above.
Further information
Further information on Pester can be found on the Pester Wiki:
https://github.com/pester/Pester/wiki
0 Comments