Gradle4.6+JUnit5:`-Dtest.single`不起作用?
使用Gradle4.6,我做了一个超级简单的测试项目来测试JUnit5的兼容性。看来单曲不行。我已经浏览了文档,我想运行一个测试类和/或一个测试方法。在这里,我期待着Gradle4.6+JUnit5:`-Dtest.single`不起作用?,gradle,junit5,Gradle,Junit5,使用Gradle4.6,我做了一个超级简单的测试项目来测试JUnit5的兼容性。看来单曲不行。我已经浏览了文档,我想运行一个测试类和/或一个测试方法。在这里,我期待着 gradle clean -Dtest.single=junittest.SampleTests test FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':test'. > Could not
gradle clean -Dtest.single=junittest.SampleTests test
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':test'.
> Could not find matching test for pattern: junittest.SampleTests
我有一个故意失败的测试用例,名为failingTest:
我的身材。格雷德尔:
apply plugin: 'java'
sourceCompatibility = 8
repositories {
mavenCentral()
maven { url "http://packages.confluent.io/maven/" }
}
test {
useJUnitPlatform()
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked"
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.1.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.1.0'
}
根据,test.single选项基于文件名模式,即替换时。使用/,它可以工作:
./gradlew clean test -Dtest.single=junittest/SampleTests
但是,在大多数情况下,使用-tests选项更容易:
./gradlew clean test --tests junittest.SampleTests
根据,test.single选项基于文件名模式,即替换时。使用/,它可以工作:
./gradlew clean test -Dtest.single=junittest/SampleTests
但是,在大多数情况下,使用-tests选项更容易:
./gradlew clean test --tests junittest.SampleTests