Set TestNG verbosity level from Maven

When I run the tests, I hate looking at the blinking cursor without suspecting that it works. To fix this, I added completion messages to all my tests. However, I realized that this is really a hacker solution and adds fluff.

Assuming the verbosity level TestNG prints a description of the test, how do I set the verbosity level in Maven? Please note that I do not have a test.xml file, so if this is the only way, then I do not know how to create a test.xml + Maven autogenerated test.xml file.

+4
source share
4 answers

Since maven-failsafe-plugin version 2.19, the level of detail can be configured as follows:

<configuration> ... <properties> <property> <name>surefire.testng.verbose</name> <value>-1</value> </property> </properties> ... </configuration> 

Note: The level of detail is from 0 to 10, where 10 is the most detailed. -1 will put TestNG in debug mode.

+1
source

Surefire allows you to call TestNG with whatever command line options you like, and TestNG supports a verbose command line, so it's probably just a matter of doing something like

 <configuration> <verbose>true</verbose> </configuration> 
0
source

Ok ... so you need to let testng.xml and pom.xml work togther.

pom.xml

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-failsafe-plugin</artifactId> <version>2.12.1</version> <executions> <execution> <id>integration-test</id> <goals> <goal>integration-test</goal> </goals> <configuration> <includes> <include>**/*IT.java</include> <include>**/*IT.groovy</include> </includes> <suiteXmlFiles> <suiteXmlFile>testng-asia.xml</suiteXmlFile> <suiteXmlFile>testng-emea.xml</suiteXmlFile> <suiteXmlFile>testng-ny.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </execution> <execution> <id>verify</id> <goals> <goal>verify</goal> </goals> </execution> </executions> </plugin> 

Then set the verbose level to testng * .xml

like

 <suite name="TEST Ex" verbose="2" preserve-order="true" > <test name="NOTE" preserve-order="true" > <classes> <class name="*IT" /> <class name="*IT"/> </classes> </test> </suite> 
0
source

Try the detailed level = 10. It does not solve the issue without XML, but it can provide you with more information that you think you need.

0
source

All Articles