ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r645886 - in /ant/antlibs/antunit/trunk/src: etc/testcases/ etc/testcases/antunit/setupandteardown/ etc/testcases/listener/ main/org/apache/ant/antunit/ tests/junit/org/apache/ant/antunit/ tests/junit/org/apache/ant/antunit/listener/
Date Tue, 08 Apr 2008 12:52:45 GMT
Author: bodewig
Date: Tue Apr  8 05:52:42 2008
New Revision: 645886

URL: http://svn.apache.org/viewvc?rev=645886&view=rev
Log:
add suiteSetUp and suiteTearDown targets, submitted by David jackman, PR: 43475

Added:
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/bothsuite.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsetup.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuitesetup.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuiteteardown.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorteardown.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failedtestsuite.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresetup.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuitesetup.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuiteteardown.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failureteardown.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuitesetup.xml   (with props)
    ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuiteteardown.xml   (with props)
Modified:
    ant/antlibs/antunit/trunk/src/etc/testcases/listener/plainlistener.xml   (props changed)
    ant/antlibs/antunit/trunk/src/etc/testcases/listener/xmllistener.xml   (props changed)
    ant/antlibs/antunit/trunk/src/etc/testcases/setupandteardown.xml
    ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
    ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/SetUpAndTearDownTest.java
    ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/PlainListenerTest.java   (contents, props changed)
    ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/XMLListenerTest.java   (contents, props changed)

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/bothsuite.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/bothsuite.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/bothsuite.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/bothsuite.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="suitesetup-and-suiteteardown"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+  
+  <target name="suiteSetUp">
+    <echo file="${outputfile}" append="true" message="A" />
+  </target>
+  
+  <target name="suiteTearDown">
+    <echo file="${outputfile}" append="true" message="B" />
+  </target>
+  
+  <target name="setUp">
+    <fail message="outputfile property is not set." unless="outputfile" />
+    <echo file="${outputfile}" append="true" message="S" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test4">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="tearDown">
+    <echo file="${outputfile}" append="true" message="T" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/bothsuite.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsetup.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsetup.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsetup.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsetup.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="failed-test"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+
+  <target name="setUp">
+    <echo file="${outputfile}" append="true" message="S" />
+    <fail message="Expected error" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="tearDown">
+    <echo file="${outputfile}" append="true" message="T" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsetup.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuitesetup.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuitesetup.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuitesetup.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuitesetup.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="failed-test"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+  
+  <target name="suiteSetUp">
+    <echo file="${outputfile}" append="true" message="A" />
+    <fail message="Expected error" />
+  </target>
+  
+  <target name="suiteTearDown">
+    <echo file="${outputfile}" append="true" message="B" />
+  </target>
+
+  <target name="setUp">
+    <echo file="${outputfile}" append="true" message="S" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test4">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="tearDown">
+    <echo file="${outputfile}" append="true" message="T" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuitesetup.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuiteteardown.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuiteteardown.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuiteteardown.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuiteteardown.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="failed-test"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+  
+  <target name="suiteSetUp">
+    <echo file="${outputfile}" append="true" message="A" />
+  </target>
+  
+  <target name="suiteTearDown">
+    <echo file="${outputfile}" append="true" message="B" />
+    <fail message="Expected error" />
+  </target>
+
+  <target name="setUp">
+    <echo file="${outputfile}" append="true" message="S" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test4">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="tearDown">
+    <echo file="${outputfile}" append="true" message="T" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorsuiteteardown.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorteardown.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorteardown.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorteardown.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorteardown.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="failed-test"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+
+  <target name="setUp">
+    <echo file="${outputfile}" append="true" message="S" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="tearDown">
+    <echo file="${outputfile}" append="true" message="T" />
+    <fail message="Expected error" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/errorteardown.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failedtestsuite.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failedtestsuite.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failedtestsuite.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failedtestsuite.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="failed-test"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+  
+  <target name="suiteSetUp">
+    <echo file="${outputfile}" append="true" message="A" />
+  </target>
+  
+  <target name="suiteTearDown">
+    <echo file="${outputfile}" append="true" message="B" />
+  </target>
+
+  <target name="setUp">
+    <fail message="outputfile property is not set." unless="outputfile" />
+    <echo file="${outputfile}" append="true" message="S" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+    <fail message="Expected failure" />
+  </target>
+
+  <target name="tearDown">
+    <echo file="${outputfile}" append="true" message="T" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failedtestsuite.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresetup.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresetup.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresetup.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresetup.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="failed-test"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+
+  <target name="setUp">
+    <echo file="${outputfile}" append="true" message="S" />
+    <au:assertPropertySet name="bogus" message="Expected failure" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="tearDown">
+    <echo file="${outputfile}" append="true" message="T" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresetup.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuitesetup.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuitesetup.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuitesetup.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuitesetup.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="failed-test"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+  
+  <target name="suiteSetUp">
+    <echo file="${outputfile}" append="true" message="A" />
+    <au:assertPropertySet name="bogus" message="Expected failure" />
+  </target>
+  
+  <target name="suiteTearDown">
+    <echo file="${outputfile}" append="true" message="B" />
+  </target>
+
+  <target name="setUp">
+    <echo file="${outputfile}" append="true" message="S" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test4">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="tearDown">
+    <echo file="${outputfile}" append="true" message="T" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuitesetup.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuiteteardown.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuiteteardown.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuiteteardown.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuiteteardown.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,63 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="failed-test"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+  
+  <target name="suiteSetUp">
+    <echo file="${outputfile}" append="true" message="A" />
+  </target>
+  
+  <target name="suiteTearDown">
+    <echo file="${outputfile}" append="true" message="B" />
+    <au:assertPropertySet name="bogus" message="Expected failure" />
+  </target>
+
+  <target name="setUp">
+    <echo file="${outputfile}" append="true" message="S" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test4">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="tearDown">
+    <echo file="${outputfile}" append="true" message="T" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failuresuiteteardown.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failureteardown.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failureteardown.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failureteardown.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failureteardown.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="failed-test"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+
+  <target name="setUp">
+    <echo file="${outputfile}" append="true" message="S" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="tearDown">
+    <echo file="${outputfile}" append="true" message="T" />
+    <au:assertPropertySet name="bogus" message="Expected failure" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/failureteardown.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuitesetup.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuitesetup.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuitesetup.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuitesetup.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="no-setup"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+  
+  <target name="suiteTearDown">
+    <echo file="${outputfile}" append="true" message="B" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test4">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuitesetup.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuiteteardown.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuiteteardown.xml?rev=645886&view=auto
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuiteteardown.xml (added)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuiteteardown.xml Tue Apr  8 05:52:42 2008
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="no-teardown"
+    default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+
+  <target name="all">
+    <fail message="These are not standalone tests." />
+  </target>
+
+  <target name="suiteSetUp">
+    <echo file="${outputfile}" append="true" message="A" />
+  </target>
+
+  <target name="test1">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test2">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test3">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+  <target name="test4">
+    <echo file="${outputfile}" append="true" message="E" />
+  </target>
+
+</project>

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/antunit/setupandteardown/nosuiteteardown.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/listener/plainlistener.xml
            ('svn:executable' removed)

Propchange: ant/antlibs/antunit/trunk/src/etc/testcases/listener/xmllistener.xml
            ('svn:executable' removed)

Modified: ant/antlibs/antunit/trunk/src/etc/testcases/setupandteardown.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/etc/testcases/setupandteardown.xml?rev=645886&r1=645885&r2=645886&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/etc/testcases/setupandteardown.xml (original)
+++ ant/antlibs/antunit/trunk/src/etc/testcases/setupandteardown.xml Tue Apr  8 05:52:42 2008
@@ -1,119 +1,281 @@
-<?xml version="1.0"?>
-<!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
--->
-
-<project name="setupandteardown-test"
-      default="all"
-         xmlns:au="antlib:org.apache.ant.antunit">
-
-  <target name="all">
-    <au:antunit>
-      <file file="${ant.file}" />
-      <au:plainlistener/>
-    </au:antunit>
-  </target>
-  
-  <!-- Verifies that both setup and teardown are called for each test -->
-  <target name="testBoth">
-    <tempfile property="outputfile" deleteonexit="true" />
-    <au:antunit>
-      <file file="antunit/setupandteardown/both.xml" />
-      <propertyset>
-        <propertyref name="outputfile" />
-      </propertyset>
-    </au:antunit>
-    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
-    <loadfile property="output" srcFile="${outputfile}" />
-    <au:assertEquals expected="SETSETSETSET" actual="${output}" />
-  </target>
-  
-  <!-- Tests no setup -->
-  <target name="testNoSetup">
-    <tempfile property="outputfile" deleteonexit="true" />
-    <au:antunit>
-      <file file="antunit/setupandteardown/nosetup.xml" />
-      <propertyset>
-        <propertyref name="outputfile" />
-      </propertyset>
-    </au:antunit>
-    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
-    <loadfile property="output" srcFile="${outputfile}" />
-    <au:assertEquals expected="ETETETET" actual="${output}" />
-  </target>
-  
-  <!-- Tests no teardown -->
-  <target name="testNoTeardown">
-    <tempfile property="outputfile" deleteonexit="true" />
-    <au:antunit>
-      <file file="antunit/setupandteardown/noteardown.xml" />
-      <propertyset>
-        <propertyref name="outputfile" />
-      </propertyset>
-    </au:antunit>
-    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
-    <loadfile property="output" srcFile="${outputfile}" />
-    <au:assertEquals expected="SESESESE" actual="${output}" />
-  </target>
-  
-  <!-- Verifies teardown is called for a failed test -->
-  <target name="testFailedTest">
-    <tempfile property="outputfile" deleteonexit="true" />
-    <au:antunit failOnError="false" errorProperty="failure">
-      <file file="antunit/setupandteardown/failedtest.xml" />
-      <propertyset>
-        <propertyref name="outputfile" />
-      </propertyset>
-    </au:antunit>
-    <fail unless="failure" message="Test should have failed." />
-    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
-    <loadfile property="output" srcFile="${outputfile}" />
-    <au:assertEquals expected="SET" actual="${output}" />
-  </target>
-  
-  <!-- Tests a failure in setup -->
-  <target name="testFailedSetup">
-    <tempfile property="outputfile" deleteonexit="true" />
-    <au:antunit failOnError="false" errorProperty="failure">
-      <file file="antunit/setupandteardown/failedsetup.xml" />
-      <propertyset>
-        <propertyref name="outputfile" />
-      </propertyset>
-    </au:antunit>
-    <fail unless="failure" message="Test should have failed." />
-    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
-    <loadfile property="output" srcFile="${outputfile}" />
-    <au:assertEquals expected="ST" actual="${output}" />
-  </target>
-  
-  <!-- Tests a failure in teardown -->
-  <target name="testFailedTeardown">
-    <tempfile property="outputfile" deleteonexit="true" />
-    <au:antunit failOnError="false" errorProperty="failure">
-      <file file="antunit/setupandteardown/failedteardown.xml" />
-      <propertyset>
-        <propertyref name="outputfile" />
-      </propertyset>
-    </au:antunit>
-    <fail unless="failure" message="Test should have failed." />
-    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
-    <loadfile property="output" srcFile="${outputfile}" />
-    <au:assertEquals expected="SET" actual="${output}" />
-  </target>
-
-</project>
+<?xml version="1.0"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<project name="setupandteardown-test"
+      default="all"
+         xmlns:au="antlib:org.apache.ant.antunit">
+         
+<typedef name="reportlistener"
+    classname="org.apache.ant.antunit.SetUpAndTearDownTest$TestReportListener"/>
+    
+  <target name="all">
+    <au:antunit>
+      <file file="${ant.file}" />
+      <au:plainlistener/>
+    </au:antunit>
+  </target>
+  
+  <!-- Verifies that both setup and teardown are called for each test -->
+  <target name="testBoth">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit>
+      <file file="antunit/setupandteardown/both.xml" />
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="SETSETSETSET" actual="${output}" />
+  </target>
+  
+  <!-- Tests no setup -->
+  <target name="testNoSetup">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit>
+      <file file="antunit/setupandteardown/nosetup.xml" />
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="ETETETET" actual="${output}" />
+  </target>
+  
+  <!-- Tests no teardown -->
+  <target name="testNoTeardown">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit>
+      <file file="antunit/setupandteardown/noteardown.xml" />
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="SESESESE" actual="${output}" />
+  </target>
+  
+  <!-- Verifies teardown is called for a failed test -->
+  <target name="testFailedTest">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit failOnError="false" errorProperty="failure">
+      <file file="antunit/setupandteardown/failedtest.xml" />
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <fail unless="failure" message="Test should have failed." />
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="SET" actual="${output}" />
+  </target>
+  
+  <!-- Tests a failure in setup -->
+  <target name="testFailureSetup">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit failOnError="false" errorProperty="failure">
+      <file file="antunit/setupandteardown/failuresetup.xml" />
+      <au:plainlistener/>
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <fail unless="failure" message="Test should have failed." />
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="STSTST" actual="${output}" />
+  </target>
+  
+  <!-- Tests an error in setup -->
+  <target name="testErrorSetup">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit failOnError="false" errorProperty="failure">
+      <file file="antunit/setupandteardown/errorsetup.xml" />
+      <au:plainlistener/>
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <fail unless="failure" message="Test should have failed." />
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="STSTST" actual="${output}" />
+  </target>
+  
+  <!-- Tests a failure in teardown -->
+  <target name="testFailureTeardown">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit failOnError="false" errorProperty="failure">
+      <file file="antunit/setupandteardown/failureteardown.xml" />
+      <au:plainlistener/>
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <fail unless="failure" message="Test should have failed." />
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="SETSETSET" actual="${output}" />
+  </target>
+  
+  <!-- Tests a error in teardown -->
+  <target name="testErrorTeardown">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit failOnError="false" errorProperty="failure">
+      <file file="antunit/setupandteardown/errorteardown.xml" />
+      <au:plainlistener/>
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <fail unless="failure" message="Test should have failed." />
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="SETSETSET" actual="${output}" />
+  </target>
+
+  <!-- Verifies that both suiteSetUp and suiteTearDown are called for the whole test script -->
+  <target name="testBothSuite">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit>
+      <file file="antunit/setupandteardown/bothsuite.xml" />
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="ASETSETSETSETB" actual="${output}" />
+  </target>
+  
+  <!-- Tests no suiteSetUp -->
+  <target name="testNoSuiteSetUp">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit>
+      <file file="antunit/setupandteardown/nosuitesetup.xml" />
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="EEEEB" actual="${output}" />
+  </target>
+  
+  <!-- Tests no suiteTearDown -->
+  <target name="testNoSuiteTearDown">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit>
+      <file file="antunit/setupandteardown/nosuiteteardown.xml" />
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="AEEEE" actual="${output}" />
+  </target>
+  
+  <!-- Verifies suite teardown is called for a failed test -->
+  <target name="testFailedTestSuite">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit failOnError="false" errorProperty="failure">
+      <file file="antunit/setupandteardown/failedtestsuite.xml" />
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <fail unless="failure" message="Test should have failed." />
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="ASETB" actual="${output}" />
+  </target>
+
+  <!-- Tests a failure in suiteSetUp -->
+  <target name="testFailureSuiteSetUp">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit failOnError="false" errorProperty="failure">
+      <file file="antunit/setupandteardown/failuresuitesetup.xml" />
+      <au:plainlistener/>
+      <reportlistener/>
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <fail unless="failure" message="Test should have failed." />
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="AB" actual="${output}" />
+  </target>
+
+  <!-- Tests an error in suiteSetUp -->
+  <target name="testErrorSuiteSetUp">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit failOnError="false" errorProperty="failure">
+      <file file="antunit/setupandteardown/errorsuitesetup.xml" />
+      <au:plainlistener/>
+      <reportlistener/>
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <fail unless="failure" message="Test should have failed." />
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="AB" actual="${output}" />
+  </target>
+  
+  <!-- Tests a failure in suiteTearDown -->
+  <target name="testFailureSuiteTearDown">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit failOnError="false" errorProperty="failure">
+      <file file="antunit/setupandteardown/failuresuiteteardown.xml" />
+      <au:plainlistener/>
+      <reportlistener/>
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <fail unless="failure" message="Test should have failed." />
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="ASETSETSETSETB" actual="${output}" />
+  </target>
+  
+  <!-- Tests an error in suiteTearDown -->
+  <target name="testErrorSuiteTearDown">
+    <tempfile property="outputfile" deleteonexit="true" />
+    <au:antunit failOnError="false" errorProperty="failure">
+      <file file="antunit/setupandteardown/errorsuiteteardown.xml" />
+      <au:plainlistener/>
+      <reportlistener/>
+      <propertyset>
+        <propertyref name="outputfile" />
+      </propertyset>
+    </au:antunit>
+    <fail unless="failure" message="Test should have failed." />
+    <au:assertFileExists file="${outputfile}" message="Output file doesn't exist" />
+    <loadfile property="output" srcFile="${outputfile}" />
+    <au:assertEquals expected="ASETSETSETSETB" actual="${output}" />
+  </target>
+
+</project>

Modified: ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java?rev=645886&r1=645885&r2=645886&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java (original)
+++ ant/antlibs/antunit/trunk/src/main/org/apache/ant/antunit/AntUnit.java Tue Apr  8 05:52:42 2008
@@ -82,6 +82,16 @@
      * name of the magic tearDown target.
      */
     private static final String TEARDOWN = "tearDown";
+    
+    /**
+     * name of the magic suiteSetUp target.
+     */
+    private static final String SUITESETUP = "suiteSetUp";
+    
+    /**
+     * name of the magic suiteTearDown target.
+     */
+    private static final String SUITETEARDOWN = "suiteTearDown";
 
     /**
      * The build files to process.
@@ -224,12 +234,47 @@
         Map targets = newProject.getTargets();
         boolean setUp = targets.containsKey(SETUP);
         boolean tearDown = targets.containsKey(TEARDOWN);
+        boolean suiteSetUp = targets.containsKey(SUITESETUP);
+        boolean suiteTearDown = targets.containsKey(SUITETEARDOWN);
 
         // start test
         newProject.fireBuildStarted();
 
         Throwable caught = null;
         try {
+            if (suiteSetUp) {
+                boolean success = false;
+                try {
+                    newProject.executeTarget(SUITESETUP);
+                    success = true;
+                } catch (AssertionFailedException e) {
+                    fireStartTest(SUITESETUP);
+                    fireFail(SUITESETUP, e);
+                } catch (BuildException e) {
+                    boolean failed = false;
+                    fireStartTest(SUITESETUP);
+
+                    // try to see whether the BuildException masks
+                    // an AssertionFailedException. If so, treat
+                    // it as failure instead of error.
+                    Throwable t = e.getCause();
+                    while (t != null && t instanceof BuildException) {
+                        if (t instanceof AssertionFailedException) {
+                            failed = true;
+                            fireFail(SUITESETUP, (AssertionFailedException) t);
+                            break;
+                        }
+                        t = ((BuildException) t).getCause();
+                    }
+
+                    if (!failed) {
+                        fireError(SUITESETUP, e);
+                    }
+                }
+                if (!success) {
+                    return;
+                }
+            }
             Iterator iter = targets.keySet().iterator();
             while (iter.hasNext()) {
                 String name = (String) iter.next();
@@ -308,6 +353,35 @@
         } catch (Throwable e) {
             caught = e;
         } finally {
+            if (suiteTearDown) {
+                try {
+                    newProject.executeTarget(SUITETEARDOWN);
+                } catch (AssertionFailedException e) {
+                    fireStartTest(SUITETEARDOWN);
+                    fireFail(SUITETEARDOWN, e);
+                } catch (BuildException e) {
+                    boolean failed = false;
+                    fireStartTest(SUITETEARDOWN);
+
+                    // try to see whether the BuildException masks
+                    // an AssertionFailedException. If so, treat
+                    // it as failure instead of error.
+                    Throwable t = e.getCause();
+                    while (t != null && t instanceof BuildException) {
+                        if (t instanceof AssertionFailedException) {
+                            failed = true;
+                            fireFail(SUITETEARDOWN, (AssertionFailedException) t);
+                            break;
+                        }
+                        t = ((BuildException) t).getCause();
+                    }
+
+                    if (!failed) {
+                        fireError(SUITETEARDOWN, e);
+                    }
+                }
+            }
+
             newProject.fireBuildFinished(caught);
             newProject = null;
         }

Modified: ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/SetUpAndTearDownTest.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/SetUpAndTearDownTest.java?rev=645886&r1=645885&r2=645886&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/SetUpAndTearDownTest.java (original)
+++ ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/SetUpAndTearDownTest.java Tue Apr  8 05:52:42 2008
@@ -1,59 +1,202 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.ant.antunit;
-
-import org.apache.tools.ant.BuildFileTest;
-
-public class SetUpAndTearDownTest extends BuildFileTest {
-
-    public SetUpAndTearDownTest(String name) {
-        super(name);
-    }
-
-    public void setUp() throws Exception {
-        super.setUp();
-        configureProject("src/etc/testcases/setupandteardown.xml");
-    }
-
-
-    public void testBoth() {
-        executeTarget("testBoth");
-    }
-
-    public void testNoSetup() {
-        executeTarget("testNoSetup");
-    }
-
-    public void testNoTeardown() {
-        executeTarget("testNoTeardown");
-    }
-
-    public void testFailedTest() {
-        executeTarget("testFailedTest");
-    }
-
-    public void testFailedSetup() {
-        executeTarget("testFailedSetup");
-    }
-
-    public void testFailedTeardown() {
-        executeTarget("testFailedTeardown");
-    }
-}
\ No newline at end of file
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.ant.antunit;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.apache.ant.antunit.listener.BaseAntUnitListener;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.BuildFileTest;
+import org.apache.tools.ant.Project;
+
+public class SetUpAndTearDownTest extends BuildFileTest {
+    
+    public static class TestReportListener extends BaseAntUnitListener {
+
+        private OutputStream out = null;
+        /**
+         * Helper to store intermediate output.
+         */
+        private StringWriter inner;
+        /**
+         * Convenience layer on top of {@link #inner inner}.
+         */
+        private PrintWriter wri;
+
+        public TestReportListener() {
+            super(new BaseAntUnitListener.SendLogTo(SendLogTo.ANT_LOG), "txt");
+        }
+
+        /**
+         * Where to send the test report.
+         */
+        public void setSendLogTo(BaseAntUnitListener.SendLogTo logTo) {
+            super.setSendLogTo(logTo);
+        }
+
+        public void startTestSuite(Project testProject, String buildFile) {
+            super.startTestSuite(testProject, buildFile);
+            inner = new StringWriter();
+            wri = new PrintWriter(inner);
+            out = getOut(buildFile);
+        }
+
+        public void endTestSuite(Project testProject, String buildFile) {
+            if (out != null) {
+                try {
+                    wri.close();
+                    out.write(inner.toString().getBytes());
+                    out.flush();
+                } catch (IOException ioex) {
+                    throw new BuildException("Unable to write output", ioex);
+                } finally {
+                    close(out);
+                }
+            }
+        }
+
+        public void endTest(String target) {
+        }
+
+        public void addFailure(String target, AssertionFailedException ae) {
+            super.addFailure(target, ae);
+            wri.println("failure:" + target + "(" + ae.getMessage() + ")");
+        }
+        
+        public void addError(String target, Throwable ae) {
+            super.addError(target, ae);
+            wri.println("error:" + target + "(" + ae.getMessage() + ")");
+        }
+        
+        public void messageLogged(int level, String message) {}
+   }
+
+    public SetUpAndTearDownTest(String name) {
+        super(name);
+    }
+
+    public void setUp() throws Exception {
+        super.setUp();
+        configureProject("src/etc/testcases/setupandteardown.xml");
+    }
+
+
+    public void testBoth() {
+        executeTarget("testBoth");
+    }
+
+    public void testNoSetup() {
+        executeTarget("testNoSetup");
+    }
+
+    public void testNoTeardown() {
+        executeTarget("testNoTeardown");
+    }
+
+    public void testFailedTest() {
+        executeTarget("testFailedTest");
+        System.out.println(getLog());
+    }
+
+    public void testFailureSetup() {
+        executeTarget("testFailureSetup");
+        String log = getLog();
+        int index = log.indexOf("Tests run: 3, Failures: 3, Errors: 0,");
+        assertTrue("summary", index > -1);
+    }
+    
+    public void testErrorSetup() {
+        executeTarget("testErrorSetup");
+        String log = getLog();
+        int index = log.indexOf("Tests run: 3, Failures: 0, Errors: 3,");
+        assertTrue("summary", index > -1);
+    }
+
+    public void testFailureTeardown() {
+        executeTarget("testFailureTeardown");
+        String log = getLog();
+        int index = log.indexOf("Tests run: 3, Failures: 3, Errors: 0,");
+        assertTrue("summary", index > -1);
+    }
+    
+    public void testErrorTeardown() {
+        executeTarget("testErrorTeardown");
+        String log = getLog();
+        int index = log.indexOf("Tests run: 3, Failures: 0, Errors: 3,");
+        assertTrue("summary", index > -1);
+    }
+
+    public void testBothSuite() {
+        executeTarget("testBothSuite");
+    }
+
+    public void testNoSuiteSetup() {
+        executeTarget("testNoSuiteSetUp");
+    }
+
+    public void testNoSuiteTeardown() {
+        executeTarget("testNoSuiteTearDown");
+    }
+
+    public void testFailedTestSuite() {
+        executeTarget("testFailedTestSuite");
+        System.out.println(getLog());
+    }
+
+    public void testFailureSuiteSetUp() {
+        executeTarget("testFailureSuiteSetUp");
+        String log = getLog();
+        int index = log.indexOf("Tests run: 1, Failures: 1, Errors: 0,");
+        assertTrue("summary", index > -1);
+        index = log.indexOf("failure:suiteSetUp(Expected failure)");
+        assertTrue("testname", index > -1);
+    }
+
+    public void testErrorSuiteSetUp() {
+        executeTarget("testErrorSuiteSetUp");
+        String log = getLog();
+        int index = log.indexOf("Tests run: 1, Failures: 0, Errors: 1,");
+        assertTrue("summary", index > -1);
+        index = log.indexOf("error:suiteSetUp(Expected error)");
+        assertTrue("testname", index > -1);
+    }
+    
+    public void testFailureSuiteTearDown() {
+        executeTarget("testFailureSuiteTearDown");
+        String log = getLog();
+        int index = log.indexOf("Tests run: 5, Failures: 1, Errors: 0,");
+        assertTrue("summary", index > -1);
+        index = log.indexOf("failure:suiteTearDown(Expected failure)");
+        assertTrue("testname", index > -1);
+    }
+    
+    public void testErrorSuiteTearDown() {
+        executeTarget("testErrorSuiteTearDown");
+        String log = getLog();
+        int index = log.indexOf("Tests run: 5, Failures: 0, Errors: 1,");
+        assertTrue("summary", index > -1);
+        index = log.indexOf("error:suiteTearDown(Expected error)");
+        assertTrue("testname", index > -1);
+    }
+
+}

Modified: ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/PlainListenerTest.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/PlainListenerTest.java?rev=645886&r1=645885&r2=645886&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/PlainListenerTest.java (original)
+++ ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/PlainListenerTest.java Tue Apr  8 05:52:42 2008
@@ -131,7 +131,6 @@
         assertTrue("Second tearDown not present", index > -1);
     }
     
-    /*
     public void testSuiteSetUpTearDown() {
         executeTarget("showinfo");
         String log = getLog();
@@ -144,5 +143,4 @@
         index = log.indexOf("suiteTearDown", index + 1);
         assertTrue("suiteTearDown present more than once", index == -1);
     }
-    */
 }

Propchange: ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/PlainListenerTest.java
            ('svn:executable' removed)

Modified: ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/XMLListenerTest.java
URL: http://svn.apache.org/viewvc/ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/XMLListenerTest.java?rev=645886&r1=645885&r2=645886&view=diff
==============================================================================
--- ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/XMLListenerTest.java (original)
+++ ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/XMLListenerTest.java Tue Apr  8 05:52:42 2008
@@ -66,11 +66,9 @@
         executeTarget("setupteardown");
     }
     
-    /*
     public void testSuiteSetUpTearDown() {
         executeTarget("suitesetupteardown");
     }
-    */
     
     public void testBadCharacters() {
         executeTarget("badcharacters");

Propchange: ant/antlibs/antunit/trunk/src/tests/junit/org/apache/ant/antunit/listener/XMLListenerTest.java
            ('svn:executable' removed)



Mime
View raw message