如何更改TestEngine ID以运行JUnit 5?

我有我的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-jupiter? 我从我的依赖中删除了junit-4.12,所以我想知道为什么它使用junit-vintage引擎而不是junit-jupiter。

目前使用:

 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 sro Windows 10 10.0 

如果我必须包含junit-vintage引擎,为什么我需要如果我所有的测试都是用JUnit5风格编写的呢?

如果您使用Android与JUnit Jupiter(JUnit 5),则可能会发现使用android-junit5插件配置您的Gradle构建更容易。