ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Klara Ward" <klara.w...@debitech.com>
Subject RE: JUnit tests fail -> build fail
Date Fri, 03 Aug 2001 12:32:47 GMT
I tried with this, both in junit and in the inner batchtest, and either it
said BUILD FAILED when I had haltonfailure="true" but didn't run all tests
or it said BUILD SUCCESSFUL when I had haltonfailure="false".

Maybe there's a difference between test and batchtest.

Klara

> -----Original Message-----
> From: Ravindra Jain [mailto:ravindra@ltp.soft.net]
> Sent: den 3 augusti 2001 10:17
> To: ant-user@jakarta.apache.org
> Subject: Re: JUnit tests fail -> build fail
>
>
> Hi,
>
> I'm using following thing  :
>
>   <junit printsummary="yes" fork="yes" haltonfailure="false">
>    <jvmarg value="-Djava.compiler=NONE"/>
>    <jvmarg value="-Dcroot=${build}" />
>
>              <test name="Test1"
> outfile="${build}/unitTestResults/Test1Result">
>                   <formatter type="xml"/>
>              </test>
>              <test name="Test2"
> outfile="${build}/unitTestResults/Test2Result">
>                  <formatter type="xml"/>
>              </test>
>   </junit>
>
> and it works, I mean it runs both the tests and says  "BUILD FAILED" if
> anyone of them fails.
> Maybe this is bcoz "haltonfailure" attribute's value is set to false..
> Try it..
>
> With Best Regards,
> Ravindra..
>
> ----- Original Message -----
> From: "Klara Ward" <klara.ward@debitech.com>
> To: <ant-user@jakarta.apache.org>
> Sent: Friday, August 03, 2001 4:03 PM
> Subject: RE: JUnit tests fail -> build fail
>
>
> > I don't think I got it to work.
> >  my buildfile:
> >     <target name="junittest" depends="init">
> >         <delete dir="${testresults}"/>
> >         <mkdir dir="${testresults}"/>
> >         <junit errorproperty="tests-failed">
> >             <formatter type="xml" />
> >             <jvmarg value="-Dclassroot=${build}" />
> >
> > and
> >     <target name="test" depends="junittest" if="tests-failed">
> >         <fail message="At least one test has failed" />
> >     </target>.
> >
> > started with ant test.
> > Output:
> > [snip]
> >     [junit] TEST a.b.CTest FAILED
> >     [junit] TEST a.b.DTest FAILED
> >
> > main:
> >
> > BUILD SUCCESSFUL
> >
> > Total time: 1 minute 54 seconds
> >
> > Any ideas?
> >
> > Klara
> >
> >
> > > -----Original Message-----
> > > From: Stefan Bodewig [mailto:bodewig@apache.org]
> > > Sent: den 3 augusti 2001 08:38
> > > To: ant-user@jakarta.apache.org
> > > Subject: Re: JUnit tests fail -> build fail
> > >
> > >
> > > On Fri, 3 Aug 2001, Klara Ward <klara.ward@debitech.com> wrote:
> > >
> > > > Feel like giving me a short example of how to use it?
> > >
> > > Say your main target that builds everything, runs the tests and
> > > formats reports used to be "main".  Rename that target to real-main
> > > and add a target like this:
> > >
> > > <target name="main" depends="real-main" if="tests-failed">
> > >   <fail message="At least one test has failed" />
> > > </target>
> > >
> > > and in your junit tasks add the attribute
> > > errorproperty="tests-failed".
> > >
> > > You still run the target main, as you used to do, all your stuff will
> > > build and be tested as usual.  If one of the unit test fails, the
> > > property tests-failed will be set (but all tests will be run) -
> > > otherwise the property will not be defined.
> > >
> > > When the main target is reached, it will either be skipped (resulting
> > > in BUILD SUCCESSFUL) or a BuildException with the given method will be
> > > thrown, which will give you a BUILD FAILED.
> > >
> > > Stefan
> > >
> >
>


Mime
View raw message