AppVeyor (if you're not aware of it) is a Continuous Integration provider. If you like, it's plug-and-play CI for .NET developers. It's lovely. And what's more it's "free for open-source projects with public repositories hosted on GitHub and BitBucket". Boom! I recently hooked up 2 of my GitHub projects with AppVeyor. It took me all of... 10 minutes. If that? It really is *that* good.
In order that I could run Chutzpah I needed Chutzpah to be installed on the build machine. So I had 2 choices:
- Add Chutzpah direct to the repo
- Add the Chutzpah Nuget package to the solution
Unsurprisingly I chose #2 - much cleaner.
Time to dust down the PowerShell. I created myself a "before tests script" and added it to my build. It looked a little something like this:
What this does is:
- Run Chutzpah from the installed NuGet package location, passing in the location of my Jasmine unit tests. In the case of my project there is a
chutzpah.jsonfile in the project which dictates how Chutzpah should run the tests. Also, the JUnit flag is also passed in order that Chutzpah creates a
chutzpah-results.xmlfile of test results in the JUnit format.
- We iterate through test results and tell AppVeyor about the the test passes and failures using the Build Worker API.
- If there have been any failed tests then we fail the build. If you look here you can see a deliberately failed build which demo's that this works as it should.
Thanks to Dan Jones, whose comments on this discussion provided a number of useful pointers which moved me in the right direction. And thanks to Feador Fitzner who has generously said AppVeyor will support JUnit in the future which may simplify use of Chutzpah with AppVeyor even further.