Testing environment configuration: Android + JUnit 5 + Mockito + Spek + Kotlin -
i'm having hard time configuration of testing environment based on junit jupiter (5). have 2 different errors there:
warning: testengine id 'spek' failed discover tests org.junit.platform.commons.util.preconditionviolationexception: not load class name... exception in thread "main" java.lang.nosuchmethoderror: org.junit.platform.launcher.launcher.execute(lorg/junit/platform/launcher/launcherdiscoveryrequest;)v @ com.intellij.junit5.junit5ideatestrunner.startrunnerwithargs(junit5ideatestrunner.java:61)... and configuration goes follows.
main 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" } } allprojects { repositories { google() jcenter() maven { url "http://dl.bintray.com/jetbrains/spek" } } } junitplatform { filters { engines { include 'spek' } } } module build.gradle:
apply plugin: 'com.android.application' apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'de.mannodermaus.android-junit5' android { compilesdkversion 26 buildtoolsversion "26.0.0" defaultconfig { ... testinstrumentationrunner "android.support.test.runner.androidjunitrunner" } ... compileoptions { targetcompatibility javaversion.version_1_8 sourcecompatibility javaversion.version_1_8 } } dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation 'com.android.support:appcompat-v7:26.0.2' implementation 'com.android.support:recyclerview-v7:26.0.2' testimplementation 'org.jetbrains.spek:spek-api:1.1.4' testimplementation 'org.jetbrains.spek:spek-junit-platform-engine:1.1.4' testimplementation junit5() // testimplementation 'org.junit.jupiter:junit-jupiter-engine:5.0.0' not needed when using 1 above testimplementation 'org.junit.platform:junit-platform-runner:1.0.0' testimplementation 'org.mockito:mockito-core:2.8.47' testimplementation 'com.nhaarman:mockito-kotlin-kt1.1:1.5.0' testcompileonly "de.mannodermaus.gradle.plugins:android-junit5-embedded-runtime:1.0.0" } this configuration supposed based on https://github.com/aurae/android-junit5. tried without it.
have managed find working configuration of dependencies these libraries?
Comments
Post a Comment