MyBaseIntegrationTestCase
is a class, which is a parent for ~ 150 test classes.
Now, I want to make MyBaseIntegrationTestCase
parameterized (parameter is version of external software)
So, I change it to smth like
@RunWith(Parameterized.class)
public abstract class MyBaseIntegrationTestCase extends MyBaseTestCase{
@Parameterized.Parameters(name = "with ExternalSoftware-v{0}")
public static List<String[]> allVersions() {
return Arrays.asList( ...);
}
@Parameterized.Parameter
public String externalSoftwareVersion;
}
All children of MyBaseIntegrationTestCase
became parameterized and run successfully, except the MyTestClass
, declared as
@RunWith(Parameterized::class)
class MyTestClass(override var myType: ParameterType) : MyBaseIntegrationTestCase() {
companion object {
@Parameterized.Parameters(name = "with {0}")
@JvmStatic
fun allTypes(): Collection<Array<ParameterType>> = ...
}
it fails with
java.lang.Exception: Test class should have exactly one public zero-argument constructor
I want to make all children of MyBaseIntegrationTestCase run parameterized as defined in parent class, and make MyTestClass parameterized on Cartesian product of allType and allVersions
It is impossible to make MyTestClass
not to extend MyBaseIntegrationTestCase
, this will require enormous amount of stuff to be copy-pasted.
Could you advice any ideas how to do it in JUnit4?
if anyone interested classes should be declared as:
and