Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set TestNG's verbosity level from Maven

Tags:

java

maven

testng

When I'm running tests I hate staring at a blinking cursor with no idea what's running. To fix this I've added completion messages to all my tests. However I've realized that its a really hacky solution and adds fluff.

Assuming that TestNG's verbosity level prints the test description, how can I set the verbosity level in Maven? Note that I don't have a test.xml file, so if its the only way then I have no idea how to have a test.xml file + Maven's autogenerated test.xml file work together.

like image 574
TheLQ Avatar asked Nov 05 '22 21:11

TheLQ


2 Answers

Surefire lets you invoke TestNG with any command line parameters you like, and TestNG does support a "verbose" command line, so it's probably only a matter of doing something like

<configuration>
  <verbose>true</verbose>
</configuration>
like image 194
Cedric Beust Avatar answered Nov 09 '22 17:11

Cedric Beust


Since maven-failsafe-plugin version 2.19 the verbosity level can be configured as follow:

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

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

like image 27
Noam Manos Avatar answered Nov 09 '22 15:11

Noam Manos