1 package test.dependent; 2 3 import org.testng.Assert; 4 import org.testng.annotations.Test; 5 6 /** 7 * a will fail but b should run anyway because of alwaysRun=true 8 * 9 * Created on Nov 18, 2005 10 * @author cbeust 11 */ 12 public class DependentOnGroup1AlwaysRunSampleTest { 13 14 private boolean m_ok = false; 15 16 @Test(groups = { "group-a"}) a()17 public void a() { 18 throw new RuntimeException("Voluntary failure"); 19 } 20 21 @Test(dependsOnGroups = {"group-a"}, alwaysRun = true) b()22 public void b() { 23 m_ok = true; 24 } 25 26 @Test(dependsOnMethods = {"b"}) verify()27 public void verify() { 28 Assert.assertTrue(m_ok, "method b() should have been invoked"); 29 } 30 } 31