Following the same principle of this answered question: Reading parameter values from Testng.xml file in cucumber stepdefs I need to be able to read the data coming from a @dataprovider class instead of the testng.xml
@Test(dataProvider = "allUsers", dataProviderClass = ***.automated_testing.DataProviders.DataProviderClass.class)
@Given("^user is sucessfuly logged into *** website$")
public void user_is_sucessfuly_logged_into_***_website(String userName, String passWord) throws Throwable {
homePage.logIn(userName, passWord);
}
@Given("^User clicks Overview tab$")
public void user_clicks_Overview_tab() throws Throwable {
overviewPage = homePage.goToOverviewPage();
}
In this case only the first method (which has the @Test annotation) is working, which makes total sense. But how can I use the same @Test for all the methods of the Cucumber framework?
**EDITED: I think the only reason right now for me to be using the @DataProvider is for scenarios I want to use different users with different roles. With dataprovider it creates one test for each of the objects I pass in that class, if there's another way of doing so without the need of @DataProvider would be helpful too.