#41 CUnit task similar to JUnit for executable unit tests

open
nobody
cpptasks (35)
5
2006-06-16
2006-06-16
Anonymous
No

For projects developing code in C/C++
there is a need to have an Ant task to
run executable unit tests (to be integrated
in the CruiseControl continuous builds)

We was needed is a task <cunit>
similar to <junit> for which we can specify
the executables (as a fileset) and one
that produces output that is compatible
with junitreport so it will work with CC

The current implementation is a bit of
a hack - only the fileset feature was needed
and is implemented. The CUnit task was not
developed as an independent (standalone)
ant task because it makes use of code in
JUnit (a lot of the functions are private
to the package or final so creating another
package was not possible/feasible)

How to compile the CUnit task

Ant 1.6.5 use source distribution
http://ant.apache.org/
download source .zip, unzip to C:\cygapps

in .bash_profile add env
variable ANT_HOME to point to this location
and add $ANT_HOME/bin to the path

on cygwin prompt
cd $ANT_HOME
./build.sh (bootstrapped build for ant)

for building <cunit> Ant Task
- copy sources CUnitTask.java,
CBatchTest.java,
CExecTask.java,
CUnitTestRunner.java
to the junit directory (under
Optional tasks)
- WARNING : copy junit.jar
(look at junit.sourceforge.net
for javadoc and
http://sourceforge.net/project/showfiles.php?
group_id=15278 for the binary )
to the lib directory
otherwise ant-junit will not be built
- do the following to build sources
ant allclean
ant jars

- the CUnit Ant Task is packaged in
ant-junit.jar. This needs to be copied to CC
under main\lib\ant and reporting\jsp\lib
for the unit tests to work under CC

Discussion