简体   繁体   中英

How to show maven-surefire-plugin unit test coverage report on console

I want to show unit test coverage report in tabular format whenever someone executes mvn test on console itself. I found that maven-surefire-plugin can only produce report in XML or HTML format and even that to a directory ( target/coverage-report ). Is there some other plugin that can help me achieve same output?

Yes, you can set the useFile attribute to false :

Option to generate a file test report or just output the test report to the console.

By default, this attribute is true which means that maven-surefire-plugin will output the reports to files and not in the console.

<plugin>
  <artifactId>maven-surefire-plugin</artifactId>
  <version>2.19.1</version>
  <configuration>
    <useFile>false</useFile>
  </configuration>
</plugin>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM