A Kotlin testing and specification framework for the JVM that allows to easily define specifications in a clear, understandable, human readable way.
Questions tagged [spek]
48 questions
0
votes
1 answer
Setting up Spek test for http methods using Kotlin?
How do I spin up a spek test using kotlin to test whether or not an HTTP method post has been called? Whats tripping me out is i'm having trouble mocking up the context. I'd like to pass in a method other then HttpMethod.POST to fire off the else…

sisternight438
- 153
- 1
- 1
- 12
0
votes
1 answer
Mockito, TooManyActualInvocations when testing conditions Spek Framework
For a scenario unit testing a user entering a password and password confirmation. when i try to verify the same method being called in a different on() block, i get the following error on the 2nd on()block.…

irobotxx
- 5,963
- 11
- 62
- 91
0
votes
1 answer
migration from Spek 1.x to Spek 2.x error
I'm trying to migrate to Spek 2.x. It looks like everything is set up ok, but I get the following exception:
Exception in thread "main" java.lang.IllegalStateException:
clz.java.package must not be null at
…

Boy
- 7,010
- 4
- 54
- 68
0
votes
2 answers
Flakiness in tests on Android using LiveData, RxJava/RxKotlin and Spek
Setup:
In our project (at work - I cannot post real code), we have implemented clean MVVM. Views communicate with ViewModels via LiveData. ViewModel hosts two kinds of use cases: 'action use cases' to do something, and 'state updater use cases'.…

Vlad
- 820
- 10
- 29
0
votes
2 answers
How to setup Spek Framework
I've checked the docs:
https://spekframework.org/migration/#maven-coordinates
I wanted to try out version 2.x.x, so I added in build.gradle:
testImplementation ("org.spekframework.spek2:spek-dsl-jvm:2.0.0")
testRuntimeOnly…

Luís Soares
- 5,726
- 4
- 39
- 66
0
votes
1 answer
Spek plugins fails to discover method in Runtime and throws the exception: NoSuchMethodError Exception
I'm using Spek plugin for Junit testing with Gradle build tool in the IDEA-2018.2
Here are dependency version for the above-
ext.junitPlatformVersion = '1.0.0'
ext.spekVersion = '1.1.5'
Dependency-
testRuntime…
0
votes
1 answer
Unit testing WebFlux Routers with Spek
I have been using Spring's WebFlux framework with Kotlin for about a month now, and have been loving it. As I got ready to make the dive into writing production code with WebFlux and Kotlin I found myself struggling to unit test my routers in a…

lxdr
- 451
- 1
- 5
- 21
0
votes
0 answers
How to test with Spek and Kluent
I have a simple Interface, but when I try to mock it my test fails. This is the error.
Mockito cannot mock this class: interface pmb.net.conn.types.INetworkLayer.
Mockito can only mock non-private & non-final classes.
If you're not sure why you're…

Celso Bring
- 33
- 5
0
votes
0 answers
Spek parameterized tests
I'm trying to write a single test from about 8 hours... The problem is really strange behavior (for me) in Spek. Sometimes it executes, sometimes not. I had an error "Test class cannot have two constructors" without any reason. When i deleted class…

minizibi
- 653
- 3
- 13
- 28
0
votes
0 answers
Spek unexpected order execution
how can I execute val chromeDriver = setupChromeDriverForTest() only once? I was expected that it happens if I put it in before given section, but It is called twice (with single test as you see). So I get an exception (File is using by another…

minizibi
- 653
- 3
- 13
- 28
0
votes
1 answer
Constants in Kotlin Spek Tests
I want to add some constants to my Spek test to hold the filenames of some resource files that the tests will access like this.
What is the idiomatic way to do this?
In JUnit, I would declare a static final value. But in Spek, I can't even use the…

Tom Tresansky
- 19,364
- 17
- 93
- 129
0
votes
1 answer
"Unresolved reference:" errors with testCompile
Currently, I'm getting Unresolved reference: spek and Unresolved reference: test with testCompile / testRuntime:
project(":core") {
apply plugin: "kotlin"
dependencies {
// ... other dependencies
testCompile…

Abakada
- 141
- 2
- 9
0
votes
1 answer
Cannot run the starter Spek test within a Ktor application
Im using IntellJ version 2017.2.5 to build a Ktor application. I also want to use Spek to test the app. I started with a very simple one, taken from documentation:
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.given
import…

o-0
- 1,713
- 14
- 29
0
votes
1 answer
Not run methods beforeEachTest and afterEachTest kotlin spek android
I'm trying to write a test using Spek framework on android. But I'm very confused. In accordance with the code, the presenter must be initialized in method beforeEachTest. And the condition must be cleared in method afterEachTest. But when I run the…

Konstantin
- 1
- 1
0
votes
1 answer
Why does this Spek on action not run?
When I run this example code, all the code in the "on" action does not run in Android Studio. Do you know why? what is missing?
import org.jetbrains.spek.api.Spek
import org.jetbrains.spek.api.dsl.describe
import org.jetbrains.spek.api.dsl.given…