I have a test with 15-20 different test cases, I want to run the same test with twice with two different parameters which are supposed to be passed to the test's BeforeClass method, for instance:
public class TestOne { private static ClassToTest classToTest; @BeforeClass public static void setUp() throws Exception { classToTest = new ClassToTest("Argument1", "Argument2"); } @Test public void testOne() { ........roughly 15 - 20 tests here } public class TestTwo { private static ClassToTest classToTest; @BeforeClass public static void setUp() throws Exception { classToTest = new ClassToTest("Argument3", "Argument4"); } @Test public void testOne() { ........roughly 15 - 20 tests here, same as in TestOne } As you can see the only difference between these two tests is in the setup method, which passes different values to the constructor of the ClassToTest. I don't want to replicate the test methods in both classes, but would prefer either inheritance or some other intelligent way to achieve this in one class.