I was doing some tests with JUNIT, and i am using a parameterized design where i can feed in large sets of information such as following:
@Parameterized.Parameters
public static Collection testList(){
return Arrays.asList(new Object[][] {
{"chrome", new ChromeDriver(DesiredCapabilities.chrome())},
{"firefox", new FirefoxDriver(DesiredCapabilities.firefox())}
});
}
So, my class, would run all of its tests twice; with each of those sets.
It seems that using @AfterClass
will fire after the entire set has finished. @After
fires after each test. How would I fire a function, after it iterating 1 item in the above collection?
Right now when i run it, it will run 2 iterations of 4 tests. After each iteration i need to fire a maintenance script.
The reason i have discovered is that after the first iteration of tests, it will hang until the browser closes. I dont want to close the browser until the iteration has completed.