Sunday 29 June 2014

DUnit: I know you know me. Let's get to know each other better.

The DUnit Integration with TeamCity is great. This post taking it further to get most out of TeamCity. 

We know that when a build fails, we can always visit the build log and will get to know what went wrong. This is sufficient for a developer or a build engineer to investigate and fix the issue.

However as a developer, I would be more happy if it can tell me exactly what tests are failed. Logs are OK but those are verbose; and personally, I would reserve it to be the last option. So what's the other option?

TeamCity is our friend. What about letting it know more about our test results? Let's see










This is exactly what we need. Moreover, now we have a new Tests tab showing nice test report with filtering, sorting and export options. 





Of course, there is more than what's shown here; and I would leave the reader to discover those fascinating offerings of TeamCity. For now lets focus on how to get there. 

TeamCity provides various options to enhance the experience with the build system. Such as service messages, plugins, build features etc. Among these, the easiest one is XML report processing which takes almost same amount of time as it takes to read this post.

Before we enable this feature, we need to tweak the DUnit a little bit to produce an XML report TeamCity understands. The solution is VSoft's XMLRunner for DUnit. It produces an XML report in NUnit format. The source code is available under Apache license with example. 

All we need to do now is to enable the build feature. Select the project > Edit Configuration Settings > Select Build Features option.














Click the Add build feature button and choose XML report processing. Report type being NUnit and set monitoring rules. 



Click Save and you're done! We have a full fledged DUnit integration.

Wednesday 25 June 2014

DUnit Integration with TeamCity

TeamCity supports number of testing frameworks out of the box. What about DUnit..?
Well, it is not supported out-of-the-box. When I searched around, one solution I found is to configure the test project to use the console runner and TeamCity would be happy. My CI server is now running like a charm. 





But wait, TeamCity should not have reported Success as there are failed tests I wrote intentionally. Let's take a look at the Build Log.




















Seems like TeamCity does not understand the language DUnit speaks. So we need to tell TeamCity to report the build status as failure when one of the test fails. 








Finally, it is red. Cool!


What's next? More fun with TeamCity and DUnit?