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

When System.exit() is called in a junit testcase, junit task cannot create a 
valid TEST-xxx.xml file, but a blank one

           Summary: When System.exit() is called in a junit testcase, junit
                    task cannot create a valid TEST-xxx.xml file, but a
                    blank one
           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]


Hi,
   I use the ANT'S junit task to perform auto test. In some cases when 
System.exit() is called in the testcases(actually the call is invoked by the 
thirdparty codes included in my testcases), the junit task would create a blank 
TEST-xxx.xml file instead of a valid one as a result. The following is part of 
the ant's build.xml:
        <target name="run-testcases" depends="init, compile"

                description="run the testcases" >               
                
                <junit printsummary="yes" fork="yes" maxmemory="512m" >  
                                                    
                        <classpath>                             
                                <pathelement path="${classes}"/>
                        </classpath>            
                        
                        <batchtest todir="${reports}" >
                                <fileset dir="${classes}" >
                                        <include name="**/Test*.class"/>
                                </fileset>
                                
                                <formatter type="xml"/>
                        </batchtest>
                </junit>
        </target>

    And the following is part of the testcase(just an example):
    //example to test System.exit
    public void testExample(){
        System.out.println("Begin to call System.exit...");
        System.exit(0);
        System.out.println("You should not get this message.");
    }

    public static Test suite() {

       TestSuite suite = new TestSuite();
                
       suite.addTest(new Testxxx("testExample"));

       return suite;

    }

Thank you.
Chen

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

Reply via email to