1 package test.dataprovider; 2 3 import org.testng.annotations.DataProvider; 4 import org.testng.annotations.Test; 5 6 public class FailedDataProviderSample { 7 @DataProvider dp()8 public Object[][] dp() { 9 return new Integer[][] { 10 new Integer[] { 1 }, 11 new Integer[] { 2 }, 12 new Integer[] { 3 }, 13 }; 14 } 15 16 @Test(dataProvider = "dp") f(int n)17 public void f(int n) { 18 FailedDataProviderTest.m_total += n; 19 if (n == 2) { 20 throw new RuntimeException("Failed") ; 21 } 22 } 23 24 } 25