Home » Java » java – Coverage 0 Junit 5 spring boot tests-Exceptionshub

java – Coverage 0 Junit 5 spring boot tests-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

I have tests that jacoco is not scanning and including into the report. The coverage is 0, I read a lot posts but nothing works.
Below, my configuration:

plugins {
id 'org.springframework.boot' version '2.0.4.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'

id 'jacoco'
id 'java'
id 'eclipse'
id 'maven-publish'
id 'war'
id 'base'
id 'idea'}


dependencies {
testImplementation('org.springframework.boot:spring-boot-starter-test'){
    exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
}

testImplementation 'org.junit.jupiter:junit-jupiter-api:5.3.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.3.1'*

}

jacocoTestReport {
reports {
    xml.enabled = true
    html.enabled = true
    html.destination file("${buildDir}/jacocoHtml")
}
}



check.dependsOn jacocoTestReport

In my test class I use @RunWith(MockitoJUnitRunner.class).

How to&Answers: