Home | History | Annotate | Download | only in dataprovider
      1 package test.dataprovider;
      2 
      3 import org.testng.annotations.DataProvider;
      4 import org.testng.annotations.Test;
      5 
      6 public class DependentSampleTest {
      7   @DataProvider(name = "data")
      8   public Object[][] dp() {
      9       return new Object[][] { { "ok" }, { "not ok" }, };
     10   }
     11 
     12   @Test(groups = { "a" }, dataProvider = "data")
     13   public void method1(String s) {
     14       if (!"ok".equals(s)) {
     15           throw new RuntimeException("error " + s);
     16       }
     17   }
     18 
     19   @Test(groups = { "b" }, dependsOnGroups = { "a" })
     20   public void method2() throws InterruptedException {
     21   }
     22 }
     23