Hi Cédric,
Thanks for the quick response. Regarding question #1 below, I'd like to clarify my use case:
> > 1. How can I share a setup method in the test class between all tests (test_id_1, test_id_2, . . .) ?
> Why not have them extend a common base class?
There is only one test class as below. The testng.xml will specify this one class in a test block.
In effect, I want to have the ability to setup and teardown some resources to be shared by all the
tests executed by the same factory (something along the line of @BeforeFactory). Am I insane ?
public class MyTest implements ITest {
@Factory
public Object[] createInstances() {
// parse the data file and create ITest objects
// return the array of ITest object (ie. MyTest)
}
public void testSetup() {
// doing some setup to be shared by all tests
// Note: I want this method to be called ONCE
// @BeforeClass or @BeforeTest does not work
}
@Test
public void testMethod() {
// doing the test here, using the testSetup() above
// Note: I DON'T want testSetup() called for every test
}
public void testCleanUp() {
// doing the cleanup of testSetup() at the end of all tests
}
}
Vincent