JUnit Test Report

java生成测试报告:

Maven plugin

add following plugins in the build side


   org.apache.maven.plugins
   maven-site-plugin
   3.7.1


   org.apache.maven.plugins
   maven-project-info-reports-plugin
   3.0.0

add follwing 


   
      
         org.apache.maven.plugins
         maven-surefire-report-plugin
         3.0.0-M3
      
   

Dependencies:


   junit
   junit
   4.12
   

not necessary:


   javax.annotation
   javax.annotation-api
   1.2

 

use mvn site to generate the report.

More detail about maven site: https://maven.apache.org/surefire/maven-surefire-report-plugin/

JUnit Test Report_第1张图片

 

For the code coverage:

add jacoco plugin: Junit5-version0.8.2


   org.jacoco
   jacoco-maven-plugin
   0.7.2.201409121644
   
      
         
            prepare-agent
         
      
      
      
         report
         test
         
            report
         
      
   

mvn test will generate the coverage report in the target/site/jacoco

More detail about jacoco: https://www.mkyong.com/maven/maven-jacoco-code-coverage-example/

转载于:https://my.oschina.net/slightScenery/blog/3059199

你可能感兴趣的:(JUnit Test Report)