1 package test.retryAnalyzer; 2 3 import org.testng.TestNG; 4 import org.testng.annotations.Test; 5 import test.SimpleBaseTest; 6 7 import static org.testng.Assert.assertEquals; 8 import static org.testng.Assert.assertTrue; 9 10 public class ExitCodeTest extends SimpleBaseTest { 11 @Test exitsWithZeroOnSuccess()12 public void exitsWithZeroOnSuccess() { 13 TestNG tng = create(ImmediateSuccess.class); 14 tng.run(); 15 assertEquals(tng.getStatus(), 0); 16 } 17 18 @Test exitsWithNonzeroOnFailure()19 public void exitsWithNonzeroOnFailure() { 20 TestNG tng = create(PersistentFailure.class); 21 tng.run(); 22 assertTrue(tng.getStatus() != 0); 23 } 24 25 @Test exitsWithZeroAfterSuccessfulRetry()26 public void exitsWithZeroAfterSuccessfulRetry() { 27 TestNG tng = create(EventualSuccess.class); 28 tng.run(); 29 assertEquals(tng.getStatus(), 0); 30 } 31 } 32