From ddece83ca02abc7d2e63f0febf4b4849f931bfa2 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 26 Sep 2002 12:11:38 +0000 Subject: [PATCH] would create an empty junit-noframes.html if format was not defined. PR: 12390 Testcase submitted by: Martijn Kruithof git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@273360 13f79535-47bb-0310-9956-ffa450edef68 --- .../taskdefs/optional/junitreport.xml | 25 +++++ .../TEST-sampleproject.coins.CoinTest.xml | 100 ++++++++++++++++++ ...ST-sampleproject.util.UniqueStringTest.xml | 77 ++++++++++++++ .../optional/junit/AggregateTransformer.java | 2 +- .../optional/junit/JUnitReportTest.java | 94 ++++++++++++++++ 5 files changed, 297 insertions(+), 1 deletion(-) create mode 100644 src/etc/testcases/taskdefs/optional/junitreport.xml create mode 100644 src/etc/testcases/taskdefs/optional/junitreport/TEST-sampleproject.coins.CoinTest.xml create mode 100644 src/etc/testcases/taskdefs/optional/junitreport/TEST-sampleproject.util.UniqueStringTest.xml create mode 100644 src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java diff --git a/src/etc/testcases/taskdefs/optional/junitreport.xml b/src/etc/testcases/taskdefs/optional/junitreport.xml new file mode 100644 index 000000000..2b5ab3898 --- /dev/null +++ b/src/etc/testcases/taskdefs/optional/junitreport.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/etc/testcases/taskdefs/optional/junitreport/TEST-sampleproject.coins.CoinTest.xml b/src/etc/testcases/taskdefs/optional/junitreport/TEST-sampleproject.coins.CoinTest.xml new file mode 100644 index 000000000..38d8e3dbb --- /dev/null +++ b/src/etc/testcases/taskdefs/optional/junitreport/TEST-sampleproject.coins.CoinTest.xml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + junit.framework.AssertionFailedError: DOEG + at sampleproject.coins.CoinTest.testFail(CoinTest.java:229) + + + + java.lang.RuntimeException: RTE + at sampleproject.coins.CoinTest.testException(CoinTest.java:234) + + + + + +testGetImageURL +testGetCountry +testGetDenomination +testGetYear +testGetSubType +testFail +testException +testSuccess +]]> + + diff --git a/src/etc/testcases/taskdefs/optional/junitreport/TEST-sampleproject.util.UniqueStringTest.xml b/src/etc/testcases/taskdefs/optional/junitreport/TEST-sampleproject.util.UniqueStringTest.xml new file mode 100644 index 000000000..f9e021443 --- /dev/null +++ b/src/etc/testcases/taskdefs/optional/junitreport/TEST-sampleproject.util.UniqueStringTest.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java index 73e0900c5..99bceb0cc 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java @@ -101,7 +101,7 @@ public class AggregateTransformer { protected File toDir; /** the format to use for the report. Must be FRAMES or NOFRAMES */ - protected String format; + protected String format = FRAMES; /** XML Parser factory */ private static DocumentBuilderFactory privateDBFactory; diff --git a/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java b/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java new file mode 100644 index 000000000..1033493cc --- /dev/null +++ b/src/testcases/org/apache/tools/ant/taskdefs/optional/junit/JUnitReportTest.java @@ -0,0 +1,94 @@ +/* + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2002 The Apache Software Foundation. All rights + * reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. The end-user documentation included with the redistribution, if + * any, must include the following acknowlegement: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowlegement may appear in the software itself, + * if and wherever such third-party acknowlegements normally appear. + * + * 4. The names "The Jakarta Project", "Ant", and "Apache Software + * Foundation" must not be used to endorse or promote products derived + * from this software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache" + * nor may "Apache" appear in their names without prior written + * permission of the Apache Group. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * ==================================================================== + * + * This software consists of voluntary contributions made by many + * individuals on behalf of the Apache Software Foundation. For more + * information on the Apache Software Foundation, please see + * . + */ + +package org.apache.tools.ant.taskdefs.optional.junit; + +import java.io.File; +import org.apache.tools.ant.BuildFileTest; + +/** + * Small testcase for the junitreporttask. + * First test added to reproduce an fault, still a lot to improve + * + * @author Martijn Kruithof + */ +public class JUnitReportTest extends BuildFileTest { + + public JUnitReportTest(String name){ + super(name); + } + + protected void setUp() { + configureProject("src/etc/testcases/taskdefs/optional/junitreport.xml"); + } + + protected void tearDown() { + executeTarget("clean"); + } + + /** + * Verifies that no empty junit-noframes.html is generated when frames + * output is selected via the default. + * Needs reports1 task from junitreport.xml. + */ + public void testNoFileJUnitNoFrames() { + executeTarget("reports1"); + if (new File("src/etc/testcases/taskdefs/optional/junitreport/test/html/junit-noframes.html").exists()) + { + fail("No file junit-noframes.html expected"); + } + } + +} +