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=30099>.
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=30099

about junit in ant

           Summary: about junit in ant
           Product: Ant
           Version: 1.6.1
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Optional Tasks
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


when the log4j's codes don't in my test codes, junitreport can catch the system 
out by log4j. but if i use the log4j in my test codes, junitreport can't catch 
the system out by log4j. is there anything wrong with my codes?

========== that 's a part in my ant build file

        <target name="runtest" if="debug.on">
                <taskdef name="junit" 
classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask" />
                <echo message="running tests" />
                <junit fork="yes" printsummary="yes" haltonfailure="no">
                        <formatter type="xml" />
                        <classpath>
                                <pathelement location="${compile.lib}" />
                                <pathelement location="${build.classes}" />
                                <fileset dir="${compile.lib}" 
includes="**/*.jar" />
                                <fileset dir="${build.classes}" 
includes="**/*.class" />
                        </classpath>
                        <!--test 
name="creatxr.demos.simple.AllJUnitTests.HelloWorldTest" todir="${log.tests}">
                        <formatter type="plain" />
                </test-->
                        <batchtest todir="${log.tests.xml}">
                                <!--formatter type="plain" /-->
                                <fileset dir="${build.classes}">
                                        <include name="**/*Test*" />
                                        <exclude name="**/*AllTests*" />
                                </fileset>
                        </batchtest>
                </junit>
                <echo message="reportting tests" />
                <junitreport todir="${log.tests}">
                        <fileset dir="${log.tests.xml}">
                                <include name="*.xml" />
                        </fileset>
                        <report format="frames" todir="${log.tests.doc}" />
                </junitreport>
                <!--delete file="${log.tests}/TESTS-TestSuites.xml" /-->
        </target>
========================= that 's my main code
package creatxr.demos.simple.bean;

import org.apache.log4j.Logger;

/**
 * @author Creatxr
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class HelloWorld {
        private static final Logger log = Logger.getLogger(HelloWorld.class);
        /**
         *  
         */
        public HelloWorld() {
                super();
                // TODO Auto-generated constructor stub
        }

        public void print() {
//              System.out.print("Hello World Bean");
                log.info("Hello World Bean");
        }
}
================== that's my test code
package creatxr.demos.simple.bean.AllJUnitTests;

import junit.framework.TestCase;
import org.apache.log4j.Logger;

import creatxr.demos.simple.bean.HelloWorld;

/**
 * @author Creatxr
 * 
 * TODO To change the template for this generated type comment go to Window -
 * Preferences - Java - Code Style - Code Templates
 */
public class HelloWorldTest extends TestCase {
        private static final Logger log = Logger.getLogger
(HelloWorldTest.class);

        public static void main(String[] args) {
                junit.textui.TestRunner.run(HelloWorldTest.class);
        }

        public void testPrint() {
                HelloWorld helloWorld = new HelloWorld();
                helloWorld.print();
                log.debug("HelloWorld.print() pass");
        }

}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to