对于我的Kotlin Android项目,我有以下依赖项:{
dependencies {
...
testImplementation "org.junit.platform:junit-platform-engine:1.0.2"
testImplementation "org.junit.platform:junit-platform-gradle-plugin:1.0.2"
testImplementation "org.junit.platform:junit-platform-launcher:1.0.2"
testImplementation "org.junit.platform:junit-platform-suite-api:1.0.2"
testImplementation "org.junit.jupiter:junit-jupiter-api:5.0.2"
testImplementation "org.junit.jupiter:junit-jupiter-engine:5.0.2"
testImplementation "org.junit.jupiter:junit-jupiter-params:5.0.2"
}在运行测试时遇到的错误是:
org.junit.platform.launcher.core.DefaultLauncher handleThrowable
WARNING: TestEngine with ID 'junit-vintage' failed to discover tests
java.lang.NoClassDefFoundError: org/junit/runner/manipulation/Filter
...
Caused by: java.lang.ClassNotFoundException: org.junit.runner.manipulation.Filter
Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.launcher.Launcher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;如果我的测试引擎id是junit-vintage,那么是否有可能更改它?看来它还在使用junit 4引擎。我怎样才能改变这一点,使它使用junit-木星?我把junit-4.12从我的依赖项中删除了,所以我想知道为什么它使用junit-老式引擎而不是junit-junit-木星。
目前使用:
Android Studio 3.0
Build #AI-171.4408382, built on October 20, 2017
JRE: 1.8.0_152-release-915-b01 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0如果我必须包含junit-vintage引擎,那么如果我的所有测试都是用JUnit5风格编写的,我为什么要这样做呢?
发布于 2017-11-20 15:46:19
如果你使用安卓与JUnit木星(JUnit 5),你可能会发现更容易配置你的梯度构建使用安卓-军政府5插件。
https://stackoverflow.com/questions/47372123
复制相似问题