@Listeners Annotations in TestNG
A simple ITestListener adapter that stores all the tests that were run. You can retrieve these results with the following methods: getPassedTests() getFailedTests() getSkippedTests().
In addition to that we can reuse the existing methods like onTestSuccess(ITestResult tr),onTestSkipped(ITestResult tr) and onTestFailure(ITestResult tr) of org.testng.TestListenerAdapter Class.
If you extend this class in order to override any of these methods, remember to call their super equivalent if you want this list of tests to be maintained.