It took me two evenings to bend Jenkins to my will. If you count them all, it took three evenings, but I’m not going to count that middle day where I went to bed right after dinner and had nightmares until I got up at 6AM.
The first day was fairly straightforward. I tried to blow away Jenkins on my machine to “Wash, Rinse, Repeat” and clear away the minimum that I had done in setting up the project. You know, the easy things: create the project, hook it to the source repo…not much, really. Jenkins uninstalled but it left a shadow of itself behind, which made setting it up all over again not at all instructive except to verify that my notes were correct. Yay?
So on that first day, I re-established the project, checked my notes, and then decided that, in the time left to me before bed, I wanted to get the pretty test coverage that I’d gotten with JaCoCo when I’d been playing with Java and Spring several months back.
My notes go something like this: “Add NUnit as Build Step -> “Execute Win Batch Cmd” “Blah\bin\nunit-console.exe” Okay, this was me telling Jenkins to roll in and execute NUnit on my code. Which took a weirdly long amount of time, mostly because I was tired and transcribing paths letter by letter between windows and most of the trouble was finding the right paths to things.
Turn the page and my notes are simply: “Aaargh.”
The next day, I came home, went to bed immediately after dinner and slept like the dead. If the dead had nightmares.
Today, I was determined to get the “pretty” test coverage–that gorgeous line-by-line report pointing to the exact spot you missed. My husband tried to encourage me to give up Jenkins for Team City (and yes, when I feel confident with Jenkins, I will abandon it and move on to Team City), because he said that what I was trying to do was too hard: there aren’t a lot of good free options in the .NET realm for code coverage.
The only real player that I found in the code coverage space that had a decent maintenance record was OpenCover. Don’t get me wrong. OpenCover works (once you get the right arguments–looking at you, “-register:user”) but it took a while staring at examples to realize exactly how to wrap OpenCover’s .exe around NUnit’s .exe and plug input A into output B and basically roll it up like a katamari. And, lo-and-behold, it worked (thank you, console output, for proving that I was making progress).
OpenCover generates an XML file and not anything a human would want to read, let alone look at or study. It’s data, not information. So, on to finding an additional tool that would allow me to get the line-by-line coverage. Welcome ReportGeneratorto the mix. We use the output from OpenCover as the input to ReportGenerator. And after rebuilding and refreshing, there it was: SUCCESS, line-by-line coverage in glorious pale green.
Now, I’m looking at my notes and thinking: these notes from today aren’t very good. I didn’t actually copy down the final batch commands. I just alluded to them, as I have here. But then I think that’s all for the best if my next nightly goal is to figure out how to both uninstall Jenkins and banish its ghost so I can truly work from scratch as I intend.
So, next goal: learn how to thoroughly murder Jenkins so it can be resurrected cleanly.