1 package test.configurationfailurepolicy; 2 3 import org.testng.annotations.BeforeMethod; 4 import org.testng.annotations.DataProvider; 5 import org.testng.annotations.Test; 6 7 public class ClassWithFailedBeforeMethodAndMultipleInvocations { 8 9 @BeforeMethod 10 public void setupShouldFail() { 11 throw new RuntimeException("Failing in setUp"); 12 } 13 14 @DataProvider( name = "data.provider" ) 15 public Object[][] dataProvider() { 16 return new Object[][] { 17 new Object[] { "data1" }, 18 new Object[] { "data2" } 19 }; 20 } 21 22 @Test( dataProvider = "data.provider" ) 23 public void test1( String s ) { 24 25 } 26 27 @Test( invocationCount = 2 ) 28 public void test2() { 29 30 } 31 } 32