Community
Participate
Working Groups
There is currently no API that allows plug-ins to make use of the export methods in org.eclipse.jdt.internal.junit.model.JUnitModel: - exportTestRunSession(TestRunSession, File) - exportTestRunSession(TestRunSession, OutputStream) Without a public API, plug-ins that wish to programatically save JUnit test reports or need to feed the XML data into some other process have to register their own TestRunListener and need to duplicate all the business logic that converts test results into the standard XML format. This affects all plug-ins that need to integrate with Eclipse's JUnit support or build additional functionality on top of it. A possible solution for exposing the existing methods as API would be to add them as static methods to JUnitCore and simply delegate to the implementations in JUnitModel. The API methods would use ITestRunSession instead of TestRunSession in their signatures. This would be a fairly simple API addition that would be useful to many technologies that depend on or interact with JUnit.
Move to JDT/UI
Created attachment 171604 [details] Patch to expose API for importing/exporting JUnit test results This is roughly what I had in mind. I also added the corresponding import methods to provide support for both directions of data exchange. The only thing I'm not 100% happy with are the casts to TestRunListener in the export methods. However, given that ITestRunListener is not allowed to be implemented by client code and TestRunListener is the framework's only implementation class I assume that this will not pose any problems. I understand that this contribution comes way too late for Helios, but hopefully it can be incorporated for Helios SR1 or Indigo.
Thanks, that looks good to me. Committed to HEAD with one change in JUnitCore#importTestRunSession(String, IProgressMonitor): If the import got cancelled, we now return null instead of throwing a CoreException.
Thanks for committing that :-) Are these sort of non-breaking API enhancements usually also added to service releases of the current product version (i.e., Helios SR1)?
> Are these sort of non-breaking API enhancements usually also added to service > releases of the current product version (i.e., Helios SR1)? Sorry, forgot to answer that. No, we don't add APIs in service releases (unless all hell breaks loose and the PMC allows an exception, but this bug is not severe enough for that).