Friday, November 7, 2014

Selenium : TestNg Dataprovider with DependsonMethod

TestNg Dataprovider with DependsonMethod

public class testng {
       
    @DataProvider
        public Object[][] dp() {
          Object[][] o=new Object[2][2];
          o[0][0]="a";
          o[0][1]="b";
          o[1][0]="c";
          o[1][1]="d";
          return o;
        }
   
    @Test()
    public void a1()
    {
        System.out.println("byei");
    }
   
    @Test(dependsOnMethods= { "a1" },dataProvider="dp")
    public void a2(String a,String b)
    {
        System.out.println(a+b);
    }   
}

 

Output 

byei
ab
cd

No comments:

Post a Comment