Including the test runner in the test class or suite

After building the test listener class, users can then include it at the test class level, or in the TestNG Suite XML file, as follows:

/**
* My Test Class
*
* @author Name
*
*/
@Listeners(TestNG_Listener.class)
public class MyTest {
...
}

// TestNG Suite XML File

<?xml version="1.0" encoding="UTF-8"
?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="My_Test_Suite" preserve-order="true" verbose="2">
<!-- test listeners -->
<listeners>
<listener class-name="myPath.TestNG_Listener" />
</listeners>
....

</suite>