覆盖范围0 Junit 5春季启动测试

时间:2020-02-18 17:44:51

标签: java spring-boot gradle sonarqube junit5

我有测试证明jacoco没有扫描并将其包含在报告中。覆盖率是0,我读了很多帖子,但没有用。
下面是我的配置:

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

在测试类中,我使用@RunWith(MockitoJUnitRunner.class)。

0 个答案:

没有答案