You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Benz, Michael" <mi...@cgi.com> on 2009/08/18 11:42:39 UTC

junit: Custom Formatter - Access to TestCase

Dear users,
 
we extended 'junit.framework.TestCase' (let's call it CustomTestCase) to include some custom information about a test run. Basically we execute a bunch of TestSteps in a TestCase, gather the results and evaluate in the end. We would like to write this information to xml, with a custom junit formatter, for further processing.
 
Now the problem is, that we only have access to a 'junit.framework.JUnit4TestCaseFacade' in an implementation of JUnitResultFormatter. There doesn't seem to be a way to access the 'original' CustomTestCase objects, which we would need to include the gathered results in the xml file. The only way we could think of solving this problem is to store the data in a static way, so we're then able to access it from the JUnitResultFormatter implementation. But that's kinda ugly :)
 
Are we missing something? Did anyone else encounter similar problems with extending the JUnitResultFormatter? How can we get access to our CustomTestCase objects in an 'elegant' way?
 
We found a bug somewhat related to this problem: 'https://issues.apache.org/bugzilla/show_bug.cgi?id=38999'
Although it was fixed by introducing a helper class that retrieves the correct class name but not the actual class/object.
 
We're using Ant 1.7.1.
 
Cheers,
Michael
 
----
Michael Benz
CGI Information Systems and Management Consultants (Deutschland) GmbH
Niederkasseler Lohweg 175 - 40547 Düsseldorf - Germany