01: package test.dataprovider;
02:
03: import org.testng.Assert;
04: import org.testng.TestListenerAdapter;
05: import org.testng.TestNG;
06: import org.testng.annotations.Test;
07:
08: /**
09: * TESTNG-142:
10: * Exceptions in DataProvider are not reported as failed test
11: */
12: public class FailingDataProviderTest {
13: @Test
14: public void failingDataProvider() {
15: TestNG testng = new TestNG(false);
16: testng
17: .setTestClasses(new Class[] { FailingDataProvider.class });
18: TestListenerAdapter tla = new TestListenerAdapter();
19: testng.addListener(tla);
20: testng.setVerbose(0);
21: testng.run();
22: Assert.assertEquals(tla.getFailedTests().size(), 1,
23: "Test method should be marked as failed");
24: }
25: }
|