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 27536] New: - When System.exit() is called in a junit testcase, junit task cannot create a valid TEST-xxx.xml file, but a blank one
Date Tue, 09 Mar 2004 11:16:59 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=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: dev@ant.apache.org
        ReportedBy: chen.yanbiao@zte.com.cn


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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message