TestNG Factory and @BeforeClass or @BeforeSuite used with DataProvider
when using constructor Factory together with DataProvider, the dataprovider is always run before @BeforeSuite.
Anybody know what is going on ? It is quite useless because I can't imagine that I would initialize stuff in one of @DataProviders...
A开发者_开发百科lso if I I use a DataProvider that makes constructor of @Factory run 2 times, then the test class is run 2 times with @BeforeClass and then it runs again without @BeforeClass.. The third cycle shouldn't exist, because DataProvider returns only 2 values...
It is by design like this. You just need to avoid using anything that is being initialized in @BeforeSuite method in your DataProviders or initialize it statically.
精彩评论