Is it possible to parameterize a TestSuite in junit 4 ?
For declaring a class as a test suite I need the annotation @RunWith(Suite.class)
, but the same
As already stated multiple times, it's not possible to parameterize a test suite with the runners provided by JUnit 4
.
Anyway, I wouldn't recommend to make your testclasses dependent from some externally provided state. What if you want to run a single testclass?
I would recommend to make your separate test classes @Parameterized
and use a utility class to provide the parameters:
@RunWith(Suite.class)
@SuiteClasses({ Test1.class, Test2.class })
public class TestSuite {
// suite
}
@RunWith(Parameterized.class}
public class Test1 {
public Test1(Object param1) { /* ... */ }
@Parameters
public static Collection