开发者

TestNG Factory and @BeforeClass or @BeforeSuite used with DataProvider

开发者 https://www.devze.com 2023-03-15 11:54 出处:网络
when using constructor Factory together with DataProvider, the dataprovider is always run before @BeforeSuite.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消