About Windows Installer, the .NET Framework, and Visual Studio.
Psake (pronounced like Japanese “sake”) is a build automation tool similar to others out there like make, rake, etc., but built using PowerShell as the language of choice. So it should be no surprise that I use it for my Windows Installer PowerShell Module. It’s useful for automating tasks not limited to just calling MSBuild, but also my PowerShell Help compiler (which loads the module in a separate process, thus allowing me to keep building in the same PowerShell host process), and selected tests with MSTest.
When tests fail (and when practicing TDD they often do), it can be hard to identify which tests failed. Not only are my test names long because of the root namespace, but also because all the test results are the same color. This is were psake can really shimmer. With the changes highlighted in commit 079b56f I can wrap the results to shorten the names and add a bit of flare:
The colors were chosen to mimic test results in Visual Studio’s Test Explorer which I normally use for feature-level work. This makes it easy to identify failed tests. Implemented similar to the Exec function in psake, $LASTEXITCODE is set correctly to also work with tasks like git bisect run for finding when a particular test might have been broken (though normally I run all unit tests before committing). The only real disadvantage is having to wait for MSTest to finish before seeing output but, at least for this project, the selected tests don’t take long enough for that to be a problem.
git bisect run
Hopefully you find this little script tip helpful. What sort of customizations do you like to make to your build environment?