Questions tagged [kotest]

For questions related to the Kotlin testing framework 'Kotest', which was formerly known as Kotlintest.

Kotest is an open-source testing framework for Kotlin: https://github.com/kotest/kotest/

107 questions
0
votes
0 answers

Unit Test Failing for Kotlin-Gradle

Error : java.lang.IncompatibleClassChangeError: Found interface kotlin.time.TimeMark, but class was expected at io.kotest.engine.spec.interceptor.SpecFinishedInterceptor.intercept-0E7RQCE(SpecFinishedInterceptor.kt:37) Tried Upgrading Kotlin…
rahul.cs
  • 45
  • 6
0
votes
1 answer

How to filter Kotest tests using IntelliJ IDEA

I would like to execute only a specific subset of tests locally to exclude slowly running integration tests. So only tests with the *Test suffix should be included, those ending with *IT should be excluded. The official Kotest guide offers command…
Oresztesz
  • 2,294
  • 1
  • 15
  • 26
0
votes
2 answers

Is Kotest5 compatible with pitest?

Is Kotest5 compatible with pitest? I'm using Kotest5 for my tests with a micronaut application. I am using the gradle-pitest-plugin as well as the Kotest pitest extension like the docs say. However I keep getting an error like The testing…
Rob Schwartz
  • 192
  • 1
  • 12
0
votes
0 answers

Coroutine advanceTimeBy function doesn't work

I have a simple viewModel: class myViewModel: ViewModel() { val someStringStateFlow = MutableStateFlow("") fun doSomething() { viewModelScope.launch(DispatcherProvider.Main) { delay(200) …
Behnam Maboudi
  • 655
  • 5
  • 21
0
votes
0 answers

How to properly verify a function was called in another function using Kotest and Mockk

Test that when calling underTest.subscribe() that it verifies the function here is actually called. subscription.subscribe("nats-msg-events", ::process) Test that when calling underTest.process(msg, connection) that it verifies the…
Dave Whyte
  • 39
  • 5
0
votes
0 answers

Kotest + Multiplatform Kotlin/JS project: Unable to initialize main class io.kotest.launcher.LauncherKt

Having troubles setting up Kotest in my multiplatform project (only using JS, multiplatform part is needed for some libraries). Here's relevant parts of my Gradle file. If this is relevant, it's in one of the modules of a project, I have multiple…
0
votes
1 answer

Mockk @OverrideMockKs not working with Kotest

I've using Kotest recently and I hadn't had any issues, but recently I was trying some annotations for dependency injection so to simplify the problem I created some basic classes with some methods that just print some messages, just for the sake of…
0
votes
1 answer

Kotest: PythagTriple example failing with erroneous function call

I am using IntelliJ and Maven, have downloaded the Kotest plugin, and I have added the dependencies to pom.xml (kotest-runner-junit5-jvm, kotest-assertions-core-jvm, kotest-property-jvm, all version 5.5.0). The following basic example is…
Daniel
  • 1
  • 1
0
votes
0 answers

No qualifying bean of type 'org.springframework.test.context.event.ApplicationEvents'

@RecordApplicationEvents @AutoConfigureWebTestClient @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) class VirtualAccountDepositNoticeControllerTest( private val webTestClient: WebTestClient, private val…
0
votes
1 answer

java.lang.NoSuchMethodError TestApplicationResponse.getHeaders()Lio/ktor/response/ResponseHeaders

I'm getting the following error when calling response.shouldHaveHeader . The full message is java.lang.NoSuchMethodError: io.ktor.server.testing.TestApplicationResponse.getHeaders()Lio/ktor/response/ResponseHeaders; at…
Suneel
  • 817
  • 3
  • 10
  • 23
0
votes
1 answer

Gradle + Kotest + KMongo Coroutines - Could not create instance of class

I'm writing a small application in Kotlin that uses KMongo coroutines and I want to use Kotest as the testing framework. I wrote a simple test to access a database and retrieve a document: class KabotMultiDBClientTest : StringSpec({ val client…
TestaDiRapa
  • 53
  • 1
  • 3
0
votes
1 answer

Kotlin+Maven+Spring Boot+Kotest: Unable to initialize main class io.kotest.launcher.LauncherKt

I'm trying to run a simple unit test written with Kotest on a spring boot project. But unfortunately I get an error message Testing started at 17:38 ... Error: Unable to initialize main class io.kotest.launcher.LauncherKt Caused by:…
0
votes
1 answer

Can you specify enabled condition for all test in spec in Kotest 5?

Before Kotest 5.0, you could apply a default test config to set some properties, like if the tests are enabled or what the timeout is. Kotest 4 class DbTests : StringSpec() { override val defaultTestCaseConfig: TestCaseConfig =…
FortTell
  • 5
  • 2
0
votes
1 answer

How to build Kproperty for private fields

can anyone help to answer my questions? I write the below function which receive the KProperty1 as a parameter: fun printProperty(instance: T, prop: KProperty1) { println("prop : ${prop.get(instance)}") } And I also define…
smilesum
  • 1
  • 1
0
votes
0 answers

Springboot test fails to run

I'm trying to run an integration test using kotest and running in to the below error. The tests run fine if I only run a single test but it fails when I try to run all tests in the class. Failed to find merged annotation for…