1 package test.invocationcount; 2 3 import org.testng.annotations.BeforeClass; 4 import org.testng.annotations.Test; 5 6 public class FailedInvocationCount2 { 7 int m_count; 8 int m_count2; 9 10 @BeforeClass setUp()11 public void setUp() { 12 m_count = 0; 13 m_count2 = 0; 14 } 15 16 @Test(invocationCount = 10, skipFailedInvocations = true) shouldSkipFromAnnotation()17 public void shouldSkipFromAnnotation() { 18 if (m_count++ > 3) { 19 throw new RuntimeException(); 20 } 21 } 22 23 @Test(invocationCount = 10, skipFailedInvocations = false) shouldNotSkipFromAnnotation()24 public void shouldNotSkipFromAnnotation() { 25 if (m_count2++ > 3) { 26 throw new RuntimeException(); 27 } 28 } 29 30 } 31