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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to