I'm trying to add Spek testing framework to my Android Studio project. Following the instructions Here, I ended up adding the following to my module build.gradle
:
testCompile 'org.jetbrains.spek:spek-api:1.1.5'
testCompile 'junit:junit:4.12'
testCompile "org.junit.platform:junit-platform-runner:1.0.0"
testRuntimeOnly 'org.jetbrains.spek:spek-junit-platform-engine:1.1.5'
Then I annotated my test with @RunWith(JUnitPlatform::class)
However, when I try to run the test, I get:
org.junit.platform.commons.util.PreconditionViolationException: Cannot create Launcher without at least one TestEngine; consider adding an engine implementation JAR to the classpath
Any idea what am I missing?
Apparently it doesn't work well... I ended up using kotlintest which is much easier to integrate
(For future references)
To use Kotlin and Spek + JUnit5 in Android Studio you need the following:
In project's build.gradle you need to have:
In module's build.gradle you need to have:
Simple Spek test
See
- official documentation http://spekframework.org/
- official plugin for running specs from the IDE https://github.com/raniejade/spek-idea-plugin
- Tests using Spek Framework - BDD Style vs JUnit Style https://www.youtube.com/watch?v=asDZ_7ZUiX4
- Simple Android configuration of Spek and JUnit5 https://gist.github.com/Mugurell/088daf42a4d60240ba6993681e0537a5