How to force TestNG create new instance of test class for each method if run mode is parallel="methods"
?
JUnit does it automatically but TestNG reuses same instance between methods.
Is there any option to change this behavior?
I'm running selenium tests and create webdriver in @BeforeMethod
method and store it to class variable to use it in test methods and clos on @AfterMethod
.
And I want to have ability to run methods of one test class in parallel without sharing webdriver.
@BeforeMethod
and@AfterMethod
is not a good idea. I would suggest to use TestNG with QAF which takes care of driver management and other black-box testing needs utilizing all features of TestNG in best efficient way. - user861594