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 11531] New: - Use code below to get test name from any Test, not just TestCase
Date Wed, 07 Aug 2002 15:31:25 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=11531>.
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=11531

Use code below to get test name from any Test, not just TestCase

           Summary: Use code below to get test name from any Test, not just
                    TestCase
           Product: Ant
           Version: 1.5
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Optional Tasks
        AssignedTo: ant-dev@jakarta.apache.org
        ReportedBy: ender@one.net


Please add the else clause below to getTestCaseName() in JUnitVersionHelper.  
This will allow any class implementing Test (not just TestCase) to have its 
test methods named in the JUnit summaries and JUnitReport output.

    public static String getTestCaseName(Test t) {
        if (t instanceof TestCase && testCaseName != null) {
            try {
                return (String) testCaseName.invoke(t, new Object[0]);
            } catch (Throwable e) {}
        }
        else
        {
          try {
            Method getNameMethod = t.getClass().getMethod("getName", new Class
[0]);
            return (String) getNameMethod.invoke(t, new Object[0]);
          } catch (Throwable e) {}
        }
        return "unknown";
    }

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


Mime
View raw message