I have a java test which is based on guice. I want to pass multiple parameter sets which are supported by JUnitParams
. But it looks like I can pass only one @RunWith
. So essentially I can add either JUnitParamsRunner
or GuiceTestRunner
. What is the way out?
Asked
Active
Viewed 147 times
0

Adam Michalik
- 9,678
- 13
- 71
- 102

Oliver Blue
- 677
- 2
- 9
- 22
1 Answers
1
No, you cannot have multiple runners for one test class - this is a limitation of JUnit 4. You can however have a runner and multiple Rule
s. There is no official Rule
for Guice, but you can find a few third-party solutions (eg. here or here) or write your own. That way you can have a test class that is annotated with @RunWith(JUnitParamsRunner.class)
and has a @Rule
field that sets up Guice.

Adam Michalik
- 9,678
- 13
- 71
- 102