Hi there,

This works for me. I hope it helps.
Pedro

<target name="run">
        <mkdir dir="${tests.reports.dir}"/>
        <junit printsummary="false" haltonerror="false"
haltonfailure="false" fork="${junit.fork}"
            errorproperty="test.failed" failureproperty="test.failed">
            <formatter type="plain" usefile="false"/>
            <formatter type="xml"/>
            <classpath>
                        //.....
            </classpath>
            <batchtest todir="${tests.reports.dir}" unless="testClass">
                <fileset dir="${tests.class.dir}"
includes="**/*Test.class"/>
            </batchtest>
        </junit>

        <junitreport todir="${tests.reports.dir}">
            <fileset dir="${tests.reports.dir}" includes="TEST-*.xml"/>
            <report format="frames" todir="${tests.reports.dir}/html"/>
        </junitreport>

        <fail if="test.failed" message="Tests failed after making report."/>
 </target>

-----Mensaje original-----
De: Keith Collison [mailto:[EMAIL PROTECTED]
Enviado el: viernes, 01 de julio de 2005 22:30
Para: cactus-user@jakarta.apache.org
Asunto: Problem using runservertests & failureproperty


Hello,

In my current environment, I manually create a "cactified" war file and
use runservertests to execute the tests.  Everything happens as
expected, with one important hitch -- my "failureproperty" is not
getting set as expected.

Here are my two relevant targets:

<target name="run.server.tests" depends="init">
       <runservertests
           testurl="${cactus.test.url}"
           starttarget="start.tomcat"
           stoptarget="stop.cactus"
           testtarget="test.server"
               />
       <echo message="within run.server.tests, test
failed=[${test.failed}]"/>
   </target>
<target name="test.server"
    description="Runs junit on test cases.">
    <delete dir="${test.result.dir}"/>
    <mkdir dir="${test.result.dir}"/>
    <property name="test" value="Test*"/>
    <junit printsummary="true"
           haltonerror="false"
               haltonfailure="false"
           failureproperty="test.failed"
       >
       <classpath>
         <path refid="cactus.classpath"/>
         <pathelement location="${cactus.classes.dir}"/>
       </classpath>

       <formatter type="plain" usefile="false"/>
       <formatter type="xml"/>

       <batchtest todir="${test.result.dir}" >
         <fileset dir="${test.web.dir}">
               <include name="**/${test}.java"/>
               <exclude name="**/Base*.java"/>
               <exclude name="**Abstract**"/>
         </fileset>
       </batchtest>
    </junit>
       <echo message="test failed:[${test.failed}]"/>
   </target>

Note the echo tasks I have.  When I run the tests and there are test
failures, my output is:

[echo] within test.server target, test failed=[true]
[echo] within run.server.tests, test failed=[${test.failed}]

Obviously the failure property is not being permanently set by the
test.server target  Am I misunderstanding how this is supposed to work?
Are there other ways of accomplishing the same goal (without use of the
<cactus> task)?

Thank you in advance.

Keith



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to