在具有testng注释的测试类中首先调用什么方法:
在我的测试中,我找到了顺序: 1. @DataProvider 2. @BeforeMethod
但是,我的@DataProvider使用了仅在@BeforeMethod中初始化的变量。这里最好的办法是什么?
我的情况如下:
class Test
@BeforeClass
//here I initialize pages (pageobjects in context of selenium)
@BeforeMethod
//here i 'get' the page I want (and the one i'll use in dataprovider)
@Test(dataProvider = "dp")
//my test goes here...
@DataProvider
dp
//here I use page. The page may be 'usable' only if it was already 'get'.发布于 2014-09-02 11:52:37
删除@BeforeMethod注释,使其为private,并从数据提供程序中显式调用它。
https://stackoverflow.com/questions/18177359
复制相似问题