ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peterrei...@apache.org
Subject svn commit: r463028 - in /ant/core/trunk/src/tests/antunit/taskdefs/optional: ./ junit/ junit/junit-outputtoformatters-test.xml junit/junit-test.xml junit/src/ junit/src/ExampleTest.java
Date Wed, 11 Oct 2006 23:04:15 GMT
Author: peterreilly
Date: Wed Oct 11 16:04:14 2006
New Revision: 463028

URL: http://svn.apache.org/viewvc?view=rev&rev=463028
Log:
tests for outputtoformatters

Added:
    ant/core/trunk/src/tests/antunit/taskdefs/optional/
    ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/
    ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/junit-outputtoformatters-test.xml
    ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/junit-test.xml
    ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/src/
    ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/src/ExampleTest.java

Added: ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/junit-outputtoformatters-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/junit-outputtoformatters-test.xml?view=auto&rev=463028
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/junit-outputtoformatters-test.xml
(added)
+++ ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/junit-outputtoformatters-test.xml
Wed Oct 11 16:04:14 2006
@@ -0,0 +1,120 @@
+<project default="all" xmlns:au="antlib:org.apache.ant.antunit">
+  <property name="ant-build" location="../../../../../../build"/>
+  <property name="build-junit-dir" location="${ant-build}/ant-unit/junit-dir"/>
+  <property name="classes.dir" location="${build-junit-dir}/classes"/>
+  <property name="reports.dir" location="${build-junit-dir}/report"/>
+
+  <macrodef name="assert-file-not-contains" backtrace="no">
+    <sequential>
+      <au:assertFalse>
+        <isfileselected file="${reports.dir}/TEST-ExampleTest.txt">
+          <contains text="Hello From Test"/>
+        </isfileselected>
+      </au:assertFalse>
+    </sequential>
+  </macrodef>
+
+  <macrodef name="assert-file-contains" backtrace="no">
+    <sequential>
+      <au:assertTrue>
+        <isfileselected file="${reports.dir}/TEST-ExampleTest.txt">
+          <contains text="Hello From Test"/>
+        </isfileselected>
+      </au:assertTrue>
+    </sequential>
+  </macrodef>
+
+  <macrodef name="assert-log-not-contains" backtrace="no">
+    <sequential>
+      <au:assertLogDoesntContain text="Hello From Test" />
+    </sequential>
+  </macrodef>
+
+  <macrodef name="assert-log-contains" backtrace="no">
+    <sequential>
+      <au:assertLogContains text="Hello From Test" />
+    </sequential>
+  </macrodef>
+
+  <macrodef name="run-junit">
+    <attribute name="fork"/>
+    <attribute name="showoutput"/>
+    <attribute name="outputtoformatters"/>
+    <sequential>
+      <junit fork="@{fork}" haltonfailure="no" showoutput="@{showoutput}"
+           outputtoformatters="@{outputtoformatters}">
+        <test name="ExampleTest" todir="${reports.dir}"/> 
+        <classpath path="${classes.dir}"/>
+        <formatter type="plain" usefile="yes"/>
+      </junit>
+    </sequential>
+  </macrodef>
+
+  <target name="init">
+    <delete quiet="yes" dir="${build-junit-dir}"/>
+    <mkdir  dir="${classes.dir}"/>
+    <mkdir  dir="${reports.dir}"/>
+  </target>
+    
+  <target name="compile" depends="init">
+    <javac srcdir="src" destdir="${classes.dir}" debug="yes"/>
+  </target>
+
+  <target name="test-show-yes-formatters-yes" depends="compile">
+    <run-junit fork="yes" showoutput="yes"
+               outputtoformatters="yes"/>
+    <assert-log-contains/>
+    <assert-file-contains/>
+  </target>
+
+  <target name="test-show-yes-formatters-no" depends="compile">
+    <run-junit fork="yes" showoutput="yes"
+               outputtoformatters="no"/>
+    <assert-log-contains/>
+    <assert-file-not-contains/>
+  </target>
+
+  <target name="test-show-yes-formatters-no-forkno" depends="compile">
+    <run-junit fork="no" showoutput="yes"
+               outputtoformatters="no"/>
+    <assert-log-contains/>
+    <assert-file-not-contains/>
+  </target>
+
+  <target name="test-show-no-formatters-no" depends="compile">
+    <run-junit fork="yes" showoutput="no"
+               outputtoformatters="no"/>
+    <assert-log-not-contains/>
+    <assert-file-not-contains/>
+  </target>
+
+  <target name="test-show-no-formatters-no-fork-no" depends="compile">
+    <run-junit fork="no" showoutput="no"
+               outputtoformatters="no"/>
+    <assert-log-not-contains/>
+    <assert-file-not-contains/>
+  </target>
+
+  <target name="test-show-no-formatters-yes" depends="compile">
+    <run-junit fork="yes" showoutput="no"
+               outputtoformatters="yes"/>
+    <assert-log-not-contains/>
+    <assert-file-contains/>
+  </target>
+
+  <target name="test-show-no-formatters-yes-fork-no" depends="compile">
+    <run-junit fork="no" showoutput="no"
+               outputtoformatters="yes"/>
+    <assert-log-not-contains/>
+    <assert-file-contains/>
+  </target>
+
+  <target name="all">
+    <au:antunit>
+      <fileset file="${ant.file}"/>
+      <au:plainlistener/>
+    </au:antunit>
+  </target>
+
+</project>
+

Added: ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/junit-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/junit-test.xml?view=auto&rev=463028
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/junit-test.xml (added)
+++ ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/junit-test.xml Wed Oct 11 16:04:14
2006
@@ -0,0 +1,56 @@
+<project default="all" xmlns:au="antlib:org.apache.ant.antunit">
+  <property name="ant-build" location="../../../../../../build"/>
+  <property name="build-junit-dir" location="${ant-build}/ant-unit/junit-dir"/>
+  <property name="classes.dir" location="${build-junit-dir}/classes"/>
+  <property name="reports.dir" location="${build-junit-dir}/report"/>
+  
+
+  <target name="init">
+    <delete quiet="yes" dir="${build-junit-dir}"/>
+    <mkdir  dir="${classes.dir}"/>
+    <mkdir  dir="${reports.dir}"/>
+  </target>
+    
+  <target name="compile" depends="init">
+    <javac srcdir="src" destdir="${classes.dir}" debug="yes"/>
+  </target>
+
+  <target name="test-junit-show-output-yes" depends="compile">
+    <junit fork="yes" haltonfailure="no" showoutput="yes"
+           outputtoformatters="no">
+      <test name="ExampleTest" todir="${reports.dir}"/> 
+      <classpath path="${classes.dir}"/>
+      <formatter type="plain" usefile="yes"/>
+    </junit>
+    <au:assertLogContains text="Hello From Test" />
+    <au:assertFalse>
+      <isfileselected file="${reports.dir}/TEST-ExampleTest.txt">
+        <contains text="Hello From Test"/>
+      </isfileselected>
+    </au:assertFalse>
+  </target>
+
+  <target name="test-junit-show-output-no" depends="compile">
+    <junit fork="yes" haltonfailure="no" showoutput="no"
+           outputtoformatters="no">
+      <test name="ExampleTest" todir="${reports.dir}"/> 
+      <classpath path="${classes.dir}"/>
+      <formatter type="plain" usefile="yes"/>
+    </junit>
+    <au:assertLogDoesntContain text="Hello From Test" />
+    <au:assertFalse>
+      <isfileselected file="${reports.dir}/TEST-ExampleTest.txt">
+        <contains text="Hello From Test"/>
+      </isfileselected>
+    </au:assertFalse>
+  </target>
+
+  <target name="all">
+    <au:antunit>
+      <fileset file="${ant.file}"/>
+      <au:plainlistener/>
+    </au:antunit>
+  </target>
+
+</project>
+

Added: ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/src/ExampleTest.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/src/ExampleTest.java?view=auto&rev=463028
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/src/ExampleTest.java (added)
+++ ant/core/trunk/src/tests/antunit/taskdefs/optional/junit/src/ExampleTest.java Wed Oct
11 16:04:14 2006
@@ -0,0 +1,7 @@
+import junit.framework.TestCase;
+
+public class ExampleTest extends TestCase {
+    public void testHello() {
+        System.out.println("Hello From Test");
+    }
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message