In java based approach, BeforeMethod is not executed, if @Test used with dataprovider and Groups attribute.
Ex:
@Test(dataProvider = "dataManager", groups={"regression"})
public void Test1(String s)
{
System.out.println(s);
}
@BeforeMethod
public void beforemethod(Method currentMethod, Object[] testArgs)
{
System.out.println("****Before Method******");
}
@DataProvider ( name = "dataManager", parallel = true)
public Object[][] getData1()
{
String[][] s=new String[1][1];
s[0][0]="Test1";
return s;
}
Please include (alwaysRun=true) in beforeMethod call, as mentioned in the below TestNg issue.
In java based approach, BeforeMethod is not executed, if @Test used with dataprovider and Groups attribute. Ex: @Test(dataProvider = "dataManager", groups={"regression"}) public void Test1(String s) { System.out.println(s); } @BeforeMethod public void beforemethod(Method currentMethod, Object[] testArgs) { System.out.println("****Before Method******"); } @DataProvider ( name = "dataManager", parallel = true) public Object[][] getData1() { String[][] s=new String[1][1]; s[0][0]="Test1"; return s; }
Please include (alwaysRun=true) in beforeMethod call, as mentioned in the below TestNg issue.
https://github.com/cbeust/testng/issues/378