I want to create TestSuite from several text files. Each text file must be one test and contain parameters for this test. I created a test like:
@RunWith(Parameterized.class) public class SimpleTest { private static String testId = "TestCase 1"; private final String parameter; @BeforeClass public static void beforeClass() { System.out.println("Before class " + testId); } @AfterClass public static void afterClass() { System.out.println("After class " + testId); } @Before public void beforeTest() { System.out.println("Before test for " + testId + ":" + parameter); } @After public void afterTest() { System.out.println("After test for " + testId + ":" + parameter); } @Parameters public static Collection<String[]> getParameters() {
Now I want to create a Suite that runs this test several times. But since Parameterized, BeforeClass, and AfterClass are only executed once, this seems a little impossible.
So to summarize:
- I want to run the test several times.
- Every time I need an input parameter (As the name of a text file)
- Each time the BeforeClass, AfterClass, and Parameters functions should be called
- I prefer not to subclass for each text file.
Is it possible?
user269343
source share