Is it possible for an Eclipse plugin to change the display name of unit tests run by the default Eclipse JUnit plugin?
Some background: I'm trying to create a plugin which will display unit test names (in the JUnit view in Eclipse) a bit different from the actual method name. If the actual test method name is "anEmptyCollectionHasSizeZero" I want it to be displayed in the Eclipse JUnit view as "An empty collection has size zero".
I've managed to display the test method names in the way described above as a separate view in a plugin, but would as I said like to get this feature integrated in the normal JUnit view. I tried to see if I could find a related extension point, but could not find anything. Is it possible to do this?
Also, is there a plugin which already does this, or similar?
I don't know the exact answer, but the best place to start is likely by looking at the code for org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart
(in the plug-in org.eclipse.jdt.junit
). That ViewPart
is the JUnit view that you see in Eclipse.
It looks like org.eclipse.jdt.internal.junit.model.TestCaseElement.getTestMethodName()
might be the place where the name is obtained from. Maybe you can trace how/when those elements are created and inject some other name. It looks like the implementation class is internal though (org.eclipse.jdt.internal.junit.model.TestElement
), so you might be out of luck.
I'd suggest asking on the JDT forums about the possibility of doing this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With