diff options
Diffstat (limited to 'framework/src/ant/apache-ant-1.9.6/src/tests/antunit/taskdefs/optional/junit/junit-outputtoformatters-test.xml')
-rw-r--r-- | framework/src/ant/apache-ant-1.9.6/src/tests/antunit/taskdefs/optional/junit/junit-outputtoformatters-test.xml | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/framework/src/ant/apache-ant-1.9.6/src/tests/antunit/taskdefs/optional/junit/junit-outputtoformatters-test.xml b/framework/src/ant/apache-ant-1.9.6/src/tests/antunit/taskdefs/optional/junit/junit-outputtoformatters-test.xml new file mode 100644 index 00000000..29068e48 --- /dev/null +++ b/framework/src/ant/apache-ant-1.9.6/src/tests/antunit/taskdefs/optional/junit/junit-outputtoformatters-test.xml @@ -0,0 +1,137 @@ +<?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 default="all" xmlns:au="antlib:org.apache.ant.antunit"> + <import file="../../../antunit-base.xml" /> + <property name="ant-build" location="../../../../../../build"/> + <property name="build-junit-dir" location="${ant-build}/ant-unit/junit-dir"/> + <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="${resources}"/> + <formatter type="plain" usefile="yes"/> + </junit> + </sequential> + </macrodef> + + <target name="init"> + <delete quiet="yes" dir="${build-junit-dir}"/> + <mkdir dir="${resources}"/> + <mkdir dir="${reports.dir}"/> + </target> + + <target name="compile" depends="init"> + <javac srcdir="src" destdir="${resources}" 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> + |