res*_*ent 5 java gradle junit5
我在多项目中有以下 build.gradle:
plugins {
id 'idea'
id 'eclipse'
id 'java'
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDir file('src/integration-test/java')
}
resources.srcDir file('src/integration-test/resources')
}
}
configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestCompile.extendsFrom testCompile
integrationTestRuntime.extendsFrom testRuntime
}
test {
useJUnitPlatform()
minHeapSize = "2048m"
maxHeapSize = "6144m"
reports {
junitXml.enabled = true
html.enabled = true
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.6.0'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.6.0'
integrationTestRuntime 'org.junit.jupiter:junit-jupiter-engine:5.6.0'
compile "org.seleniumhq.selenium:selenium-java:3.141.59"
}
task integrationTest(type: Test) {
useJUnitPlatform()
minHeapSize = "10g"
maxHeapSize = "10g"
outputs.upToDateWhen { false }
group = LifecycleBasePlugin.VERIFICATION_GROUP
description = 'Runs the integration tests.'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
binResultsDir = file("$buildDir/integration-test-results/binary/integrationTest")
reports {
html.enabled = true
junitXml.enabled = true
html.destination = file("$buildDir/integration-test-results")
junitXml.destination = file("$buildDir/integration-test-results")
}
mustRunAfter tasks.test
}
Run Code Online (Sandbox Code Playgroud)
当我运行 gradle IntegrationTest 时,会调用集成测试,但仅生成二进制报告:
构建/集成测试结果/二进制/integrationTest
没有 XML 或 HTML 结果!看来 JUnit 5 与 JUnit 4 相比发生了根本性的变化。我如何获得 XML 或 HTML 报告?
归档时间: |
|
查看次数: |
1296 次 |
最近记录: |