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 23862] New: - Cannot use overriden TestCase.getName() method in <junit> task
Date Thu, 16 Oct 2003 10:34:43 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23862>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23862

Cannot use overriden TestCase.getName() method in <junit> task

           Summary: Cannot use overriden TestCase.getName() method in
                    <junit> task
           Product: Ant
           Version: 1.5.3
          Platform: Sun
        OS/Version: Solaris
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: jason.morris@citigroup.com


I have a JUnit test class which has it's own implementation of the runTest() 
and getName() methods. This is so that I can get more detail in the output of 
my test cases by enhancing the test name.

It works fine if I use the junit.textui.TestRunner runner but not the ant 
<junit> runner.

Looking at the code for 
org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter, it seems 
that it uses Reflection to get a handle on the Method for getName(). The 
problem is that it explicitly grabs the getName() method for the base class 
junit.framework.TestCase, rather than calling getClass() on the individual 
TestCase object.

Because of this, my overridden getName() method is bypassed and the base-class 
version is always used.

A pretty minor thing but it would be really useful to use the object instance 
to find the getName() method rather than always assuming it should use the base 
class version.

Many thanks,

Jason Morris

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


Mime
View raw message