Combine TestNGListener with log4j for selenium result reporting

This post will explain the integration of any java logger (let’s say Log4j) with ITestListener to customise result output and print the same to log file. We have seen testNG and it’s listener ITestListener to customise the result output.   Watch details here Log4j maven dependency Use below dependency – <!– https://mvnrepository.com/artifact/log4j/log4j –> <dependency> <groupId>log4j</groupId>…

TestNG Listener – customise output with ITestListener

TestNG provides many listeners (as interfaces) which you can customise to your need to get output more readable. Here are the listeners – IAnnotationTransformer IAnnotationTransformer2 IHookable IInvokedMethodListener IMethodInterceptor IReporter ISuiteListener ITestListener Source – TestNG Listeners From this above listeners, in this post we will see ITestListener ITestListener interface has the following methods to implement void…