1package test.dataprovider;
2
3import org.testng.annotations.DataProvider;
4import org.testng.annotations.Test;
5
6public 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