Custom JUnit test runner method execution problem

I am in the process of creating a custom JUnit test runner but I am having trouble integrating it with the IntelliJ JUnit plugin smoothly.

The custom runner is similar to the JUnit Parameterized runner in terms of creating several test runs for each test class.

I was able to execute the test class as a whole with my runner, and see the nice tree of test method executions that the IntelliJ JUnit plugin provides.

However, when I want to execute only a single test method with the runner by right-clicking on the method in the editor and clicking "Run", I get a message back saying:

java.lang.Exception: No tests found matching Method testMyStuff(org.somename.MyClassTest) from org.junit.internal.requests.ClassRequest@5627f221
 at org.junit.internal.requests.FilterRequest.getRunner(FilterRequest.java:35)
 at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:67)





.
Is this a bug in the JUnit plugin or do I need to take a different approach?
.



I have found two workarounds, but neither one is feasible:


1. Pretend my custom runner is really the JUnit Parameterized runner by renaming the custom runner class to "Parameterized", and putting it into the org.junit.runners package. (Yes, this is awful)
2. Extend the JUnit Parameterized class. (Not  a good approach, as Parameterized is not designed to be extended.)


.
Thanks for any help,


Uli
1 comment

Still would like to see a better approach to this issue. IntelliJ does not currently support custom runners in the style of the JUnit Parameterized runner for running tests at the method level or parameterized instance level. I would have thought that it might use the test descriptions provided by the JUnit framework to make this happen, but that's not what it does.

My current workaround is a big hack: copy the original JUnit Parameterized runner code into the org.junit.runners package in my own codebase, and add whatever other functionality I need to this class.

Assistance appreciated.

Thanks,

Uli

0

Please sign in to leave a comment.