My own Cliffs Notes on PowerShell unit testing. Hope it helps you as well. I may update this as I move along.
1. For serious, robust programming, TDD is definitely the way to go;
2. I looked at both Pester and PSUnit. Despite the 10 votes (so far) for the Pester answer on a stackoverflow question, my tinkering with both led me to conclude that I will use PSUnit.
Overall, the notes here are helpful, but I needed to tweak a few places to get it working in my dev environment.
3. The download zip file from CodePlex has the timestamp of 20090806 and has Beta status. Don’t worry about it;
4. Move files around and create directories as necessary. You need to check each ps1 file’s property and click Unblock. It will be nice to have this automated;
5. After creating a PowerShell profile under C:\Users\haidong\Documents\WindowsPowerShell and copying the profile files, profile.ps1 needs to be modified: $PSUnitPath = “C:\Users\haidong\PSUnit”;
6. Microsoft.PowerShellISE_profile.ps1 also needs to be modified. Comment out the CTP3 line and uncomment the . PSUnit.ISE.ps1 line;
7. Run PowerShell as Administrator. You need to do this even if you are logged in as Administrator. Then do “set-executionpolicy RemoteSigned”;
8. The ISE addon menu is really handy. If you are running Windows 2008 R2, PowerShell ISE may not come installed. Add this feature using Server Manager.