6/06/2006

embUnit has some additional features

I posted about my options for proceeding with CruiseControl. A while ago I already wrote a python script which ran the unit tests, and interpreted the results into XML following the JUnit schema. This seemed to be working, but there was one major problem. embUnit output did not include any detail about successfull tests. So I started looking my options again. I took a look at CUnit. It has XML output for its own translator, but this of course does not follow JUnit schema either, so I was not getting any closer.

Then while browsing through embUnit source I made an interesting discovery. The code for embUnit library does not require standard C libraries. This I believe is the embedded part of it. In the distribution there is however additional source code for two different user interfaces; 1) text and 2) XML. These can be compiled into another library (the basic libary comes as binary with distribution), which can be used for host run unit tests. Two libraries can be tied together with nice function pointer usage, similar to what I tried to explain earlier. Everything is coming together beatifully. Example of generated XML report is below. This again does not of course follow the JUnit schema, so I will continue by modifying the CruiseControl XSL translator for it.



To be cont'd...

2 comments:

Anonymous said...

Hello, I downloaded embunit, build it ,ran the test. What do I need to do produce xml output? Thanks!

Timo said...

Hi,
I assume you did read the embunit docs? http://embunit.sourceforge.net

I assume that you also build the textUI library. You need to link both of the static libs in your build; libembunit.a and libtextui.a.

In your main you need to call the runner like this:

TextUIRunner_setOutputter(XMLOutputter_outputter());

TextUIRunner_start();

TextUIRunner_runTest(shutterTest_tests());

TextUIRunner_end();

I'm almost finished with my CruiseControl page for embUnit and C. I hope to be able to put it online today...