1 package test.listeners; 2 3 import org.testng.Assert; 4 import org.testng.TestNG; 5 import org.testng.annotations.Test; 6 7 import test.SimpleBaseTest; 8 9 import java.util.Arrays; 10 11 public class ListenerInXmlTest extends SimpleBaseTest { 12 13 @Test(description = "Make sure that listeners defined in testng.xml are invoked") listenerInXmlShouldBeInvoked()14 public void listenerInXmlShouldBeInvoked() { 15 TestNG tng = create(); 16 tng.setTestSuites(Arrays.asList(getPathToResource("listener-in-xml.xml"))); 17 LListener.invoked = false; 18 tng.run(); 19 Assert.assertTrue(LListener.invoked); 20 } 21 } 22