Problems with JUnit

"CC User" <[email protected]>
Newsgroups gmane.comp.java.cruise-control.user
Message-ID <[email protected]>
Hello,

I am using JUnit with CruiseControl. The tests are executed successfully. I get the following in the console window:

[cc]Sep-11 18:44:13 ScriptRunner  - ccAntProgress -- init
[cc]Sep-11 18:44:13 ScriptRunner  - ccAntProgress -- compile
[cc]Sep-11 18:44:13 ScriptRunner  - ccAntProgress -- test
[cc]Sep-11 18:44:13 ScriptRunner  -     [junit] Testsuite: MyClassTest
[cc]Sep-11 18:44:13 ScriptRunner  -     [junit] Tests run: 1, Failures: 0, Error
s: 0, Time elapsed: 0,093 sec
[cc]Sep-11 18:44:13 ScriptRunner  -     [junit]
[cc]Sep-11 18:44:13 ScriptRunner  -
[cc]Sep-11 18:44:13 ScriptRunner  - BUILD SUCCESSFUL

Yet in the JUnit log file, I can read the following:
<testsuite errors="1" failures="0" ...

When I open the CruiseControl web UI, it tells me:
Test MyClassTest FAILED

Even more annoying is the line below:

Unit Tests: (0)
No Tests Run
This project doesn't have any tests 

However, obviously CruiseControl is accessing the test results. Do I have to register the tests additionally in config.xml?

This is my config.xml:
<cruisecontrol>
   	<project name="test">

        <listeners>
            <currentbuildstatuslistener file="logs/${project.name}/status.txt"/>
        </listeners>

        <bootstrappers>
			<currentbuildstatusbootstrapper file="logs/${project.name}/status.txt" />

            
        </bootstrappers>

        <modificationset quietperiod="1">
            <!-- touch any file in connectfour project to trigger a build -->
            <svn LocalWorkingCopy="C:/Users/.../Documents/test-checkout"/>
        </modificationset>

        <schedule interval="30">
			<composite>
			<exec command="svn" args="up C:\Users\...\Documents\test-checkout"/>
            <ant anthome="apache-ant-1.7.0" buildfile="C:/Users/.../Documents/test-checkout/build.xml" target="compile,test"/>
			</composite>
        </schedule>

        <log dir="projects/${project.name}">
           
        </log>

        <publishers>
			<!--htmlemail mailhost="smtp.mail.yahoo.de"
			  returnaddress="[email protected]"
			  username="[email protected]"
			  password=""
			  skipusers="true"
			  reportsuccess="fixes"
			  subjectprefix="[CruiseControl]"
			  buildresultsurl="http://buildserver:8080/cruisecontrol/buildresults"
			  logdir="logs/${project.name}/"
			  xsldir="C:\Program Files\CruiseControl\webapps\cruisecontrol\xsl"
			  mailport="25"
			  css="C:\Program Files\CruiseControl\webapps\cruisecontrol\css\cruisecontrol.css">
			  <failure address="[email protected]" />
			  <success address="[email protected]" />
			</htmlemail-->
			<!--artifactspublisher dest="artifacts/${project.name}" file="C:\Users\...\Documents\test-checkout\build"/-->
        </publishers>

    </project>
</cruisecontrol>

And the build.xml from Ant:
<?xml version="1.0"?>
<project name="test" default="compile" basedir=".">

     <property name="src" value="src"/>
     <property name="build" value="build"/>
	 <property name="junit.dir" value="C:\Program Files\CruiseControl\projects\test"/>
	 <property name="test.class" value="MyClassTest"/>

	<path id="classpath">
		<pathelement location="${build.dir}" />
		<pathelement location="${junit.jar}" />
	</path>

     <target name="init"> 
          <mkdir dir="${build}"/>
		  <mkdir dir="${junit.dir}"/>
     </target>

     <target name="compile" depends="init">
          <!-- Compile the java code -->  
          <javac srcdir="${src}" destdir="${build}"/>
     </target>
	 
	<target name="test" depends="compile" description="unit test" >
		<junit errorProperty="test.failed" failureProperty="test.failed">
		  <test name="${test.class}" todir="${junit.dir}" />
		  <formatter type="brief" usefile="false" />
		  <formatter type="xml" />
		  <classpath refid="classpath" />
		</junit>
    <fail message="Tests failed: check test reports." if="test.failed" />
  </target>
</project>

Thanks a lot to anyone helping me!
-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.