1 package test.configuration; 2 3 import org.testng.ITestResult; 4 import org.testng.TestListenerAdapter; 5 import org.testng.annotations.BeforeClass; 6 import org.testng.annotations.Listeners; 7 import org.testng.annotations.Test; 8 9 import test.configuration.ConfigurationListenerSampleTest.MyTLA; 10 11 @Listeners(MyTLA.class) 12 public class ConfigurationListenerSampleTest { 13 static boolean m_passed = false; 14 15 public static class MyTLA extends TestListenerAdapter { 16 @Override onConfigurationFailure(ITestResult itr)17 public void onConfigurationFailure(ITestResult itr) { 18 m_passed = true; 19 } 20 } 21 22 @BeforeClass bm()23 public void bm() { 24 m_passed = false; 25 throw new RuntimeException(); 26 } 27 28 @Test f1()29 public void f1() { 30 } 31 }