Strange if i put in the changes as you suggested it does not even execute my 
targets. If I run the following on the command line

ant build -Dunit.test=true

 
On Monday, November 23, 2009, at 09:52PM, "glenn opdycke-hansen" 
<glenn...@gmail.com> wrote:
>I agree that there is nothing obviously incorrect.  However, do you run unit
>tests and acceptance tests at the same time?
>If so then there is a potential problem that the script will run the unit
>tests then the acceptance tests then check the properties.
>I suggest that the <if><then> not be used, instead have the test target
>depend on targets for unit test and acceptance test.  Each of the new tasks
>should check the tests.* properties.  I do not use <if><then>.  Some would
>argue that it should not be used in Ant.  Do you know if properties set in
><if><then> will be present to the parent?
>
>The script would look something like this:
>
>       <target name="test" description="Runmning unit tests"
>depends="test-unit,test-acceptance">
>       </target>
>
>       <target name="test-unit" if="${unit.test}">
>           <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>
>
>            <fail if="tests.errors" message="Test errors!!!"  />
>            <fail if="tests.failures"  message="Test failed!!!"/>
>
>       </target>
>
>       <target name="test-acceptance" if="${acceptance.test}">
>           <echo message="running acceptence tests for ${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="**/*AcceptenceTestCase.java" />
>                </fileset>
>            </batchtest>
>            </junit>
>
>            <fail if="tests.errors" message="Test errors!!!"  />
>            <fail if="tests.failures"  message="Test failed!!!"/>
>
>       </target>
>
>

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

Reply via email to