@DataProvider and @BeforeMethod order
What method is invoked first in a test class with testng annotations:
annotated with @DataProvider
annotated with @BeforeMethod
?
During my testing I found the order: 1. @DataProvider 2. @BeforeMethod
But my @DataProvider uses the variable that will be initialized only in
@BeforeMethod. What workaround may be the best here?
My case is the following:
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'.
No comments:
Post a Comment