ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 41940] - BuildFileTest assumes a project file has at least one target
Date Wed, 25 Apr 2007 08:15:41 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41940>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41940


jan@materne.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From jan@materne.de  2007-04-25 01:15 -------
I had a look and modified BFT (rev 532247):

    protected void tearDown() throws Exception {
        if (project == null) {
            /*
             * Maybe the BuildFileTest was subclassed and there is
             * no initialized project. So we could avoid getting a
             * NPE.
             * If there is an initialized project getTargets() does
             * not return null as it is initialized by an empty
             * HashSet.
             */
            return;
        }
        final String tearDown = "tearDown";
        if (project.getTargets().containsKey(tearDown)) {
            project.executeTarget(tearDown);
        }
    }


I modified your example

public class MyAntTestClass extends org.apache.tools.ant.BuildFileTest {
    public void testBaseline() {
  	  junit.framework.Assert.assertTrue(true);
    }
    
    public static void main(String[] args) {
        junit.textui.TestRunner.run(MyAntTestClass.class);
    }
}

<project default="junit">

    <path id="cp">
        <fileset dir="c:/seu/junit3.8.2/junit3.8.2" includes="*.jar" />
        <fileset dir="${ant.home}/lib" includes="*.jar" />
        <pathelement path="." />
    </path>

    <javac srcdir="." destdir="." classpathref="cp" />

    <target name="junit">
        <junit>
            <test name="MyAntTestClass" />
            <classpath refid="cp" />
        </junit>
    </target>

    <target name="run">
        <java classname="MyAntTestClass">
            <classpath refid="cp" />
        </java>
    </target>

</project>

When using "run" (the JUnit Text-TestRunner) that works. When using "junit"
(Ant's JUnitTestRunner) the test fails ...


Could you have a look?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message