Skip to content
Advertisement

How to print exceptions on console? I am using TestNG and Maven

I want to see the exceptions on console. I am using TestNG with Maven as a build tool. I have defined my testng.xml in the Maven surefire plugin.

Advertisement

Answer

https://www.javadoc.io/doc/org.testng/testng/latest/org/testng/reporters/VerboseReporter.html

you should use above reporter , but the constructor expects a string so you cannot initialize it using testng.xml ( if any one knows how to pass string argument to listener in testng.xml please do add it here )

So the work around is to add the listener through script and initiate testng through a java entry file.

JavaScript

Output:

enter image description here

Note

As this reporter constructor expects a string you should not provide it in your testng.xml you will get initialization error

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement