Retriving dataprovider info in BeforeMethod

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Retriving dataprovider info in BeforeMethod

Rajeev
This post has NOT been accepted by the mailing list yet.
I am trying to read dataprovider values in beforemethod. Please suggest the right way to do so.

public class Smoke_IT extends setup {
@DataProvider
public static Object[][] getTestData()  {
    return new Object[][] {
          {"test001","EXPECTED_STATUS:CREATED"},
          {"test002","EXPECTED_STATUS:PROCESSED"}
    };
}

@Test(dataProvider="getTestData")
public void verifyStatusOfTests(String testName, String testStatus) {
// do verification
}
}

public class setup {

// inside beforeMethod I intend to read testName and testStatus values so that I can update this values in a database or file.
@BeforeMethod
public class initiateDB(Object[][] dataProviderParams<How to get data provider values here?>, ITestResult result, ITestContext testContext) {
   updateDB("Insert into db values(<testName>) where run_id=" + runID);
}
}