Is there a way to pass a dynamically generated data and pass them to different test classes/suites?
What I have is the following: A username/password pair is created by TestUtil.signUpNewAccount(); and I would like to pass this account object to other test classes so that their test methods can use it.
- Test1Class.test1(){// use newUserAccount .... };
- Test1Class.test2(){// use newUserAccount .... };
- Test2Class.test1(){// use newUserAccount .... };
- Test2Class.test2(){// use newUserAccount .... };
I would recommend to use
@Factory
Factory allows you to create different test instances with different parameters http://testng.org/doc/documentation-main.html#factoriesI ended up using TestNG's ITestContext. For test classes that requires the shared dynamically generated data, I have an abstract class that initializes needed data with @BeforeClass