christophsturm
05/13/2016, 8:57 AMcedric
05/13/2016, 12:37 PM@BeforeClass
in TestNG, which gives you the same thing as creating a new instance every time. Or you can clear that state in @AfterClass
cedric
05/13/2016, 12:38 PMchristophsturm
05/13/2016, 1:41 PMcedric
05/13/2016, 1:41 PM@BeforeMethod
christophsturm
05/13/2016, 1:42 PMchristophsturm
05/13/2016, 1:42 PMchristophsturm
05/13/2016, 1:42 PMcedric
05/13/2016, 1:43 PMafter
runs after each test method I assume?christophsturm
05/13/2016, 1:43 PMcedric
05/13/2016, 1:44 PM@AfterMethod
?christophsturm
05/13/2016, 1:44 PMchristophsturm
05/13/2016, 1:44 PMcedric
05/13/2016, 1:45 PM@Factory
is the answer and it lets you manage the instances of your test classes yourself.christophsturm
05/13/2016, 1:45 PMchristophsturm
05/13/2016, 1:46 PMcedric
05/13/2016, 1:46 PMpublic class WebTestFactory {
@Factory
public Object[] createInstances() {
Object[] result = new Object[10];
for (int i = 0; i < 10; i++) {
result[i] = new WebTest(i * 10);
}
return result;
}
}
christophsturm
05/13/2016, 1:47 PMcedric
05/13/2016, 1:47 PMcedric
05/13/2016, 1:48 PMchristophsturm
05/13/2016, 1:48 PMcedric
05/13/2016, 1:48 PMcedric
05/13/2016, 1:48 PMchristophsturm
05/13/2016, 1:49 PMchristophsturm
05/13/2016, 1:49 PMcedric
05/13/2016, 1:49 PMchristophsturm
05/13/2016, 1:51 PMchristophsturm
05/13/2016, 1:51 PMcedric
05/13/2016, 1:52 PMclass HttpEndpointIT(val server: DockerServer) {
@Test
fun test() { }
@AfterMethod
fun after() = DockerUtils.stop(server)
}
class TestFactory {
@Factory
fun create() = (1..10).map { HttpEndpointIT(DockerServer(it)).toArray()
}
christophsturm
05/13/2016, 1:53 PM