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
1 answer

Check all assertion and verifications when using mockk verification together with assertion libraries

I want the test to report all assertions and verifications. So both the mockk verification AND the the assertion library (in this case, KotlinTest) assertions should run and not shortcircuit. In other words I don't want the test to stop…
Shakka
  • 137
  • 8
1
vote
1 answer

Kotlintest extensions providing information back to the test

JUnit 5 has a neat extensions functionality which is not compatible with kotlintest even if it runs on JUnit framework. While the simple use cases in which we just need to log something can be handled by the TestListener, we cannot handle more…
kboom
  • 2,279
  • 3
  • 28
  • 43
1
vote
1 answer

KotlinTest property based testing and generators

I have the following definition of a directed graph in Kotlin. (I'm still learning Kotlin so please forgive any shortcomings. Improvements and suggestions are always welcome.) My goal is to have a method, reverse, which maintains the vertices and…
Sebastian
  • 715
  • 6
  • 13
1
vote
0 answers

Why does KotlinTest IDEA plugin only nest the first leaf when using IsolationMode.InstancePerLeaf?

When I do this: class KotlinTestNestingWithAndTests8 : BehaviorSpec() { override fun isolationMode() = IsolationMode.InstancePerLeaf init { given(" Some given") { and("Some and") { `when`("Some when") { …
Julian A.
  • 10,928
  • 16
  • 67
  • 107
1
vote
1 answer

Table Driven Tests with Gradle: NoClassDefFoundError TableTestingKt

I use kotlintest in a Spring Boot Project for unit and integration testing. I can run my unit tests without any troubles in IntelliJ and all of them are green. When I run my tests in gradle with ./gradlew clean test though, all my tests using the…
peach
  • 657
  • 5
  • 26
1
vote
1 answer

Pitest not running with Kotlintest tests

I'm using kotlintest in my projects and I want to run mutation testing with pitest. Already tried using pitest alone and with junit5 plugin, but the result is always: Found 0…
1
vote
1 answer

How to have hierarchical test report with Kotlintest and Gradle

I'm trying to get a hierarchical test report from Kotlintest using Gradle. I've seen some screenshots allowing it, however, I have no luck. For any type of tests (FunSpec, WordSpec, BehaviorSpec etc) I always see only the class name and then the…
Piotr Gwiazda
  • 12,080
  • 13
  • 60
  • 91
1
vote
1 answer

Gradle fails: Failed to resolve: io after removing kotlintest

I've created a new Android Project and set up mockk in Intrument test and Unit test: androidTestImplementation "io.mockk:mockk:{1.9.3}" testImplementation "io.mockk:mockk:{1.9.3}" Gradle sync fine. If I add kotlintest and sync again…
xarly
  • 2,054
  • 4
  • 24
  • 40
1
vote
0 answers

KotlinTest jUnit reports aren't containing the BehaviorSpec steps

Using KotlinTest with gradle. Executing the tests in a Jenkins pipeline although the reports generated aren't containing the BehaviorSpec steps. This is making my reports unusable. Has anyone encountered a similar issue or knows of a different…
Zoidburg
  • 159
  • 8
1
vote
0 answers

How can I log test-specific infomation when implementing TestCaseExtension?

In a TestCaseExtension, I want to log test-specific information. At first sight, doing it like this seems to work: import io.kotlintest.* import io.kotlintest.extensions.SpecLevelExtension import io.kotlintest.extensions.TestCaseExtension import…
Marco Eckstein
  • 4,448
  • 4
  • 37
  • 48
1
vote
1 answer

Calling config on a BehaviorSpec test in kotlintest

Is it possible to configure individual test cases in a BehaviorSpec in kotlintest? For StringSpec tests it is possible to do like so: class MyTest : StringSpec({ "this is a test".config(...) {} }) I can't seem to do the same for a BehaviorSpec.…
1
vote
1 answer

How to use beforeProject in kotlintest?

I've implemented a TestListener as follows: object IntegrationTest: TestListener { override fun beforeProject() { println("integration tests - beforeProject") } override fun beforeSpec(description: Description, spec: Spec) { …
alisabzevari
  • 8,008
  • 6
  • 43
  • 67
1
vote
1 answer

KotlinTestEngine.discover() doesn't return any tests

My goal is to have a class which can find any tests written in kotlintest. I already have working code for Java/Scala/Groovy unit tests but can't get it to work for Kotlintest. My discover code: LauncherDiscoveryRequest request =…
lsrom
  • 608
  • 8
  • 22
1
vote
1 answer

Unresolved reference kotlintest while using gradle kotlin dsl

Here is my build.gradle.kts : import org.jetbrains.kotlin.config.KotlinCompilerVersion plugins { ... } android { compileSdkVersion(27) defaultConfig { ... } buildTypes { ... } sourceSets { …
tufekoi
  • 929
  • 2
  • 14
  • 33
1
vote
2 answers

Does KotlinTest also support TestNG?

Can I use KotlinTest with TestNG? I can see only JUnit in the documentation.
Klugi
  • 11
  • 2