Here it is

        <target name="test" description="Runmning unit tests">

                <if>
                        <istrue value="${unit.test}" />
                        <then>
                                <echo message="running unit tests for project 
${module}" />
                                <junit
haltonfailure="no" haltonerror="no" failureproperty="tests.failures" errorproperty="tests.errors"
                                        >

                                        <classpath>
                                                <path refid="classpath.test" />
                                        </classpath>

                                        <formatter type="brief" usefile="false" 
/>

                                        <batchtest fork="yes">
                                                <fileset dir="${src.tests}">
                                                        <include 
name="**/*UnitTestCase.java" />
                                                </fileset>
                                        </batchtest>
                                </junit>
                        </then>
                </if>

                <if>
                        <istrue value="${acceptance.test}" />
                        <then>
                                <echo message="running acceptence tests for 
${module}" />
<junit haltonfailure="yes" haltonerror="yes" failureproperty="tests.failures" errorproperty="tests.errors">

                                        <classpath>
                                                <path refid="classpath.test" />
                                        </classpath>

                                        <formatter type="brief" usefile="false" 
/>

                                        <batchtest fork="yes">
                                                <fileset dir="${src.tests}">
                                                        <include 
name="**/*AcceptenceTestCase.java" />
                                                </fileset>
                                        </batchtest>
                                </junit>
                        </then>
                </if>

                <fail if="tests.errors" message="Test errors!!!"  />
                <fail if="tests.failures"  message="Test failed!!!"/>

        </target>



On 22 Nov 2009, at 09:17, Greg Roodt wrote:

Could you please paste the entire Ant "test" target you are using?

You would definitely need to be checking for the error property, since
its not a test failure, thats an error.




On Sat, Nov 21, 2009 at 6:25 PM, Ben Cuthbert <bencuthb...@me.com> wrote:
What I have is the the following

<junit
haltonfailure="no" haltonerror="no" failureproperty="tests.failures"
errorproperty="tests.errors"
  >

       <classpath>
       <path refid="classpath.test" />
       </classpath>

       <formatter type="brief" usefile="false" />

       <batchtest fork="yes">
               <fileset dir="${src.tests}">
               <include name="**/*UnitTestCase.java" />
               </fileset>
       </batchtest>
</junit>

<fail if="tests.errors" message="Test errors!!!"  />
<fail if="tests.failures"  message="Test failed!!!"/>



On 21 Nov 2009, at 18:20, glenn opdycke-hansen wrote:

it appears that the name of the property being set is different than what
is
being checked:

<junit haltonfailure="yes" haltonerror="yes" failureproperty="*
tests.failures*" errorproperty="tests.errors">

On Sat, Nov 21, 2009 at 12:12, Ben Cuthbert <bencuthb...@me.com> wrote:

Strange thing is, if I set this property in the top of the file

<property name="tests.failed" value="true" />

And then in my target put

<fail if="*tests.failed*"  message="Test failed!!!"/>

I get and error

build-common.xml:347: Test failed!!!



On 21 Nov 2009, at 16:33, Ben Cuthbert wrote:

Yes so I have the following line in the same target at the end, I see the

unit test error but the build does not stop



     <fail if="tests.failures" />


On 21 Nov 2009, at 10:05, Greg Roodt wrote:

<fail if="tests.failures" />







---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org


Reply via email to