Tag: junit5

IntelliJ + JUnit 5(木星)

我的build.gradle有: testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.0' 使用http://junit.org/junit5/docs/current/user-guide/中的标准示例 import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; class FirstJUnit5Tests { @Test void myFirstTest() { assertEquals(2, 1 + 1); } } 当我尝试在IntelliJ 2017.2.3中作为JUnit测试运行时,我得到: objc[32347]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/bin/java (0x10f5be4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10f6864e0). One of the two will be used. Which one is undefined. Sep 11, 2017 12:39:04 PM org.junit.platform.launcher.core.DefaultLauncher handleThrowable WARNING: […]

测试环境配置:Android + JUnit 5 + Mockito + Spek + Kotlin

我很难配置基于JUnit Jupiter(5)的测试环境。 我有两个不同的错误: WARNING: TestEngine with ID 'spek' failed to discover tests org.junit.platform.commons.util.PreconditionViolationException: Could not load class with name… Exception in thread "main" java.lang.NoSuchMethodError: org.junit.platform.launcher.Launcher.execute(Lorg/junit/platform/launcher/LauncherDiscoveryRequest;)V at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:61)… 配置如下。 主build.gradle : apply plugin: 'org.junit.platform.gradle.plugin' buildscript { ext.kotlin_version = '1.1.4-3' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.0.0-beta5' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.junit.platform:junit-platform-gradle-plugin:1.0.0" classpath "de.mannodermaus.gradle.plugins:android-junit5:1.0.0" } } […]