Questions tagged [kotlintest]

KotlinTest is open-source testing framework for Kotlin

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

82 questions
1
vote
3 answers

Test all enums implementing the marker interface

I have the empty interface interface HavingUniqueValues(val v: Int) {} and some enums like enum class EnumName(override val v: Int) : HavingUniqueValues. I want the elements in each enum have unique v-values but I can mistype the values. So I need a…
SerVB
  • 129
  • 17
1
vote
1 answer

@WithMockUser and kotlin test

I'm a big fan of Kotlintest syntax and I'd like to know if it's possible to make it work with WebMvcTest. More particularly, I don't manage to annotate the test methods with @WithMockUser. Does somebody know if it's feasible? Thanks beforehand.
RomainZ
  • 41
  • 1
  • 1
  • 8
1
vote
1 answer

Intellij - thymeleaf freaking out on kotlintest

I'm developing a spring-boot appliction in kotlin with Intellij, using springMVC and thymeleaf. Simple enough, and everything workes fine until I try running some tests. And the tests are not even related. In fact, just instantiating a test seems to…
UncleBob
  • 1,233
  • 3
  • 15
  • 33
1
vote
1 answer

Running kotlintest in maven

I've been struggling for a while now trying to get kotlintest tests to run properly from maven. I'm far from a maven expert so I'm hoping someone can tell me where I'm going wrong. I started with the maven example from the kotlin repo here, and…
bbaldino
  • 394
  • 3
  • 15
1
vote
3 answers

There is a sample structure for kotlintest project

I'm currently playing with the Kotlin testing Framework https://github.com/kotlintest/kotlintest. I want to know if there is an expected way to structure the project, I mean, like a base project where I can start base on.
Jimmy Alvarez
  • 587
  • 1
  • 5
  • 13
0
votes
1 answer

How do I get ktor testApplication client to not wait for a coroutine job in the call to complete?

In the ktor application I have a route that starts a session for the created resource that launches a job to manage interactions with that session and auto-terminates the session if there are no interactions for a while // routing post("/sessions")…
user9578963
0
votes
1 answer

android. kotlin, the coverage test is failing on lateinit var member

in android kotlin class it has a lateinit var member. The coverage test is failing on the function referring to it. The simplified class here: open class TestC constructor(context: Context) { private lateinit var mModule: NotificationModule …
lannyf
  • 9,865
  • 12
  • 70
  • 152
0
votes
1 answer

How can I use kotlin.test with an Android project?

When I search for what I wrote on the title the internet is completely full of results about using JUnit, JUnit5, Mockito, TestNG and whatnot. I went over the official docs and they provide a sample with the JVM. I went ahead and gave it a try and…
Some random IT boy
  • 7,569
  • 2
  • 21
  • 47
0
votes
0 answers

Kotlin MPP conflates JVM code into my common codebase... how to force pure "common"

My MPP library has android and jvm build: kotlin { android(); jvm { /*...*/ } }. I've written a function that takes kotlinx.datetime.DayOfWeek and kotlinx.datetime.Month as parameters, but then inside of commonTest, the parameter types are…
Tyler Gannon
  • 872
  • 6
  • 19
0
votes
1 answer

Use ThreadLocal Webdriver in kotest for parallel execution

How does one use ThreadLocal Webdriver for parallel browser execution in kotest? Somehow I believe kotlin coroutines messes this up.
Ankit
  • 169
  • 1
  • 4
  • 16
0
votes
1 answer

kotlin kotest/kotlintest BehaviorSpec afterSpec/finalizeSpec called too often or not at all

I have a kotlin kotest (formerly known as kotlintest) BehaviorSpec with one Given("...") and many When("...") Then("...") under it I want to execute a cleanup after the whole Spec (respectively every Given clause) has finished. @MicronautTest …
Dirk Hoffmann
  • 1,444
  • 17
  • 35
0
votes
0 answers

How do I configure KoTest with Gradle in a LibGdx project? Currently can't build because StringSpec is not recognised

I have a standard LibGdx project setup by the LibGdx tool, only targeting desktop. It uses Gradle (Groovy DSL) to manage dependencies and tasks. I've converted the core module to Kotlin, and I'm trying to add a Kotlin test module using Kotest. I've…
Jansky
  • 1,455
  • 1
  • 17
  • 33
0
votes
1 answer

Kotlintest - Unresolved reference shouldMatchJson

Seems like I can't access shouldMatchJson matcher from Kotlintest v3.4.2 the way is documented in https://github.com/kotlintest/kotlintest/blob/master/doc/matchers.md. I get unresolved reference and I seem unable to import it. The code says it's an…
jpablo
  • 1
0
votes
1 answer

Kotlintest; how to use abstract testcontainers class

We have a Spring Boot project written in kotlin (for the first time) where we want to try kotlintest for writing tests. Our datasource is a postgresql database, and in our tests we utilize org.testcontainers:postgresql in order to not use a separate…
Terje Andersen
  • 429
  • 2
  • 17
0
votes
0 answers

Duplicate class Testable found in modules junit-platform-commons-1.4.0.jar and kotlintest-core-3.3.0.jar

Hi I'm new in Android and I'm trying to run some test. But when I try to use kotlintest I get the following error: Duplicate class org.junit.platform.commons.annotation.Testable found in modules junit-platform-commons-1.4.0.jar…
xarly
  • 2,054
  • 4
  • 24
  • 40