Pedro,

Thank you for your reply.  I should have mentioned that I do not want the build
to fail within the same target that the tests are run.  After my
"run.server.tests" has been run, there's another target invoked that undeploys
the cactified application.  If I fail the build after the tests are run, this
undeploy target is never invoked and the application remains on the server.

The simple solution, of course, is to have all the tasks done within the same
target (i.e. within your "run" target, have the undeploy task written right
before where <fail> appears).  This just seems contrary to how I think cactus
and ANT should be working together.  Namely, properties that are set in
runservertest's "testtarget" should persist throughout the rest of the build.

Thanks again for your time.

Keith


Quoting Pedro Nevado <[EMAIL PROTECTED]>:

> 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]
>
>

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

Reply via email to