The first thing to realize about the TUT framework (lightweight C++ unit testing framework - i like it :) ) is basically how it works and how TeamCity 5.x service messages work. There isn't a shortcut to understanding TUT's mechanism except to read the code so download it and understand it. On TeamCity 5.x Service Messages, refer to this article here.
Once you've done that, you'll realize that TeamCity 5.x needs you to output messages of the form
##[teamcity testSuiteStarted name='suite.name'] ... ##[teamcity testStarted name='XXX'] ... ##[teamcity testIgnored name='ccc'] ... ##[teamcity testFinished name='XXX'] ... ##[teamcity testIgnored name='ddd'] ... ##[teamcity testSuiteFinished name='suite.name']
during a build process and you'll realize that testStarted and testFinished must begin and finished in pairs, so are the testSuiteStarted and testSuiteFinished messages.
Next thing you should figure out is how and where to insert print statements in your test code. Well the short answer is to study the C++ class callback and all classes that inherit from it. Currently, tut_console_reporter.hpp and tut_cppunit_reporter.hpp are the ones i know about.
What you need to do is to realize that the TUT runner as the framework calls it, is actually invoking whatever class that inherits tut::callback (i.e. class console_reporter) and you need to implement/override the virtual C++ member functions in tut::callback so that you can place the appropriate TeamCity 5.x service messages. I won't place the code here cos its pretty easy :) and there are more than one way to do it - depends on how your unit tests are crafted.
Once you get it to work, you should see statistics on your TeamCity dashboard via the Projects dashboard and you can drill down into how long each test took, details etc.
Quick update on 8 May 2010: I've since then released this modifications to sourceforge and here's a URL to JetBrains list of available plugins.
0 comments:
Post a Comment