https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
kotest
  • m

    Marek Kubiczek

    02/05/2023, 4:13 PM
    I am getting
    Engine exception: Kotlin reflection implementation is not found at runtime. Make sure you have kotlin-reflect.jar in the classpath
    when running kotest tests from Android Studio with the help of kotest idea plugin. The same running from command line using gradle works just fine.
    s
    • 2
    • 4
  • s

    sam

    02/05/2023, 7:03 PM
    Kotest 5.5.5 released https://kotest.io/docs/next/changelog.html
  • c

    CLOVIS

    02/05/2023, 9:00 PM
    Is Kotest broken on JS? I can't figure out a way to execute JS tests. Even the demo doesn't seem to run the JS tests:
    $ ./gradlew jvmTest jsBrowserTest
    > Task :jvmTest
    io.kotest.examples.mpp.UUIDJvmTest[jvm] > uuids should be in be type 4 format[jvm] PASSED
    io.kotest.examples.mpp.data.DataDrivenTest[jvm] > PythagTriple(a=3, b=4, c=5)[jvm] PASSED
    io.kotest.examples.mpp.data.DataDrivenTest[jvm] > PythagTriple(a=6, b=8, c=10)[jvm] PASSED
    io.kotest.examples.mpp.uuid.UUIDTestCommon[jvm] > uuids should be somewhat unique![jvm] PASSED
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
    e
    a
    r
    • 4
    • 26
  • m

    Marcin Wisniowski

    02/06/2023, 4:44 PM
    When I run Kotest tests by clicking the green arrow on the test class, it uses Gradle to run them, but when I run individual tests, or run from the Kotest plugin window, it runs them differently (directly with JDK?). How can I make the plugin use Gradle to run the tests?
    l
    e
    • 3
    • 3
  • l

    Lidonis Calhau

    02/07/2023, 4:14 PM
    Hello I am trying Json support in Kotest from https://kotest.io/docs/assertions/json/json-overview.html Is there support for ignoring some values like https://github.com/lukas-krecan/JsonUnit#ignoring-values ?
    e
    • 2
    • 4
  • b

    Brent Beardsley

    02/08/2023, 6:09 PM
    I've started getting with the last couple (5.5.4 and 5.5.5) versions of kotest.
    [4.128s][warning][gc,alloc] ClassGraph-worker-16: Retried waiting for GCLocker too often allocating 1026 words
    
    UnknownClass.Kotest > UnknownClass.initializationError FAILED
        org.junit.platform.commons.JUnitException at EngineExecutionOrchestrator.java:113
            Caused by: io.kotest.engine.config.ConfigurationException at ConfigManager.kt:29
                Caused by: io.github.classgraph.ClassGraphException at ClassGraph.java:1606
                    Caused by: java.lang.OutOfMemoryError at NestedJarHandler.java:654
    
    UnknownClass.Kotest FAILED
    If I keep re-running it eventually works. Is there a kotest leak? Or am I missing some kotest setting or is there something else I should be modifying? thx
    e
    r
    • 3
    • 3
  • j

    julian

    02/08/2023, 9:09 PM
    In preparing PR #3384 for review, I tried to build, but keep getting errors that seem unrelated to the work I did. Advise, please. Thanks! Here's an example:
    Failed to execute all tests:
      :kotest-assertions:kotest-assertions-json:iosX64Test: java.lang.IllegalStateException: command '/usr/bin/xcrun' exited with errors (exit code: 148):kotest-assertions:kotest-assertions-json:watchosX64Test: java.lang.IllegalStateException: command '/usr/bin/xcrun' exited with errors (exit code: 148)
    s
    • 2
    • 4
  • p

    Piotr Krzemiński

    02/09/2023, 12:21 PM
    I’m wondering if kotest could get snapshot tests support. See https://github.com/kotest/kotest/issues/777
    c
    s
    +3
    • 6
    • 17
  • d

    Daniel Schröder

    02/09/2023, 2:54 PM
    I just updated the kotest libraries to v5.5.5 and it seems there are some files missing the the Maven Central repository. There is an issue open in the kotest github's repository: https://github.com/kotest/kotest/issues/3388 Is there a way to get around this issue?
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':common-core:compileTestKotlinIosX64'.
    > Could not resolve all files for configuration ':common-core:iosX64TestCompileKlibraries'.
       > Could not find kotest-common.klib (io.kotest:kotest-common-iosx64:5.5.5).
         Searched in the following locations:
             <https://repo.maven.apache.org/maven2/io/kotest/kotest-common-iosx64/5.5.5/kotest-common-iosx64-5.5.5.klib>
    a
    j
    • 3
    • 2
  • j

    julian

    02/12/2023, 7:29 PM
    Where may I find snapshot version numbers for Kotest?
    s
    e
    • 3
    • 46
  • j

    Jacob K

    02/15/2023, 10:11 AM
    Hello! What's the best way if I want to have an exhaustive generator + well known edge cases?
  • j

    Jacob K

    02/15/2023, 10:11 AM
    And just test the exhaustive list + edge-cases
    e
    • 2
    • 2
  • a

    abendt

    02/16/2023, 5:34 PM
    hi folks, i have a question about the usage of the kotest-bom. I was trying to harmonize the kotest version numbers in a maven multimodule setup and put the kotest-bom into the parent of that project. I have noticed that the bom does not contain all kotest artifacts (e.g. kotest-assertions-core-jvm is not there). In effect i had to define the mentioned dependency with the version number. Is it on purpose that the bom does not contain all kotest artifacts?
    a
    e
    • 3
    • 12
  • i

    Ioannis Mavroukakis

    02/17/2023, 12:45 PM
    Hello folks! I have a question with regards to clues - certain other frameworks, most notably Spock and Hamcrest, when an assertion fails they show the data under test that failed, by default. Is there any way to do this in Kotest without having to wrap everything in clues?
    c
    • 2
    • 19
  • d

    Davide Giuseppe Farella

    02/18/2023, 7:15 AM
    Hello people. I’m struggling to find the right way to use `CoroutinesScope`s in Kotest. I’m refactoring a test where I need a scope for my SUT, and before I had this:
    private val appScope = TestScope()
    private val sut = Sut(appScope)
    
    @Test
    fun `some test`() = appScope.runTest { ... }
    Now, with Kotest, I did this:
    class MyTest : BehaviorSpec({
    
        Given("abc") {
            val sut = Sut(testScope)
    It worked, till I needed to call
    advanceUntilIdle()
    (after this code) so, to achieve that, I had to add
    coroutineTestScope = true
    and it became
    class MyTest : BehaviorSpec({
        coroutineTestScope = true
    
        Given("abc") {
            val sut = Sut(testScope)
    But this doesn’t seem to work correctly, as the Flow internal to my SUT never emits. I’ll drop my SUT in the 🧵
    • 1
    • 1
  • j

    julian

    02/18/2023, 6:33 PM
    What's the latest on when
    5.6.0
    might be released?
    e
    s
    • 3
    • 7
  • j

    James Eschner

    02/21/2023, 3:21 AM
    Hello all, question about Arbs. I have a situation where my code is trying to generate an impossible-to-generate arb. To show a simple example:
    data class Foo(val x: Boolean)
    
    val fooArb: Arb<Foo> = arbitrary {
        Foo(x = false)
    }
    
    val stuck = fooArb.filter { it.x }.next()
    Now, obviously this won't work. This is a simple example but in my case, the arb is much more complex (and transient) so the situation wasn't immediately obviously. What I would have hoped would happen is that the program would eventually time out or throw trying to generate the "next" arb, but what I am witnessing is the kotest test hangs seemingly indefinitely, making it very hard to debug. What I am wonder is if there is a way to better detect this situation? Can I set a timeout? Force an error? Etc... ** Not a contribution
    a
    • 2
    • 11
  • h

    huehnerlady

    02/22/2023, 11:34 AM
    Hi, We are using DescribeSpec. Currently I am transforming some TestNG Classes to kotest and run into the issue to change the amount of invocations I found this Pull Request, but when I look into config with `describe(“foo”).config() I can see only:
    fun config(
          enabled: Boolean? = null,
          enabledIf: EnabledIf? = null,
          enabledOrReasonIf: EnabledOrReasonIf? = null,
          tags: Set<Tag>? = null,
          timeout: Duration? = null,
          failfast: Boolean? = null,
          blockingTest: Boolean? = null,
          coroutineTestScope: Boolean? = null,
          test: suspend T.() -> Unit
       )
    When I try to do that at the root level overriding the
    defaultTestCaseConfig
    function as described here, I see that this method is now deprecated, but I do not understand how else to do that. Maybe someone can help me?
    s
    • 2
    • 3
  • d

    Davide Giuseppe Farella

    02/22/2023, 3:50 PM
    Good morning. I have a problem migrating my small integration test suite to Kotest. I have a custom
    MockAppExtension
    (previously
    MockAppRule
    ) that sets up Koin with Ktor’s `MockEngine`s and in-memory SqlDelight database. I have 3 test classes with 17 tests in total. If I run a single class, all of them pass with no problem, but if I run tests for the whole module, 2 out of 17 fail with
    io.ktor.serialization.JsonConvertException: Illegal input
    on a network request I wonder what could make the difference 🤔 I tried with different `IsolationMode`s
    d
    • 2
    • 8
  • x

    xenomachina

    02/25/2023, 5:21 AM
    The concurrency docs say:
    We can configure this feature by setting the configuration field
    concurrencyMode
    or the system property
    kotest.framework.concurrency.mode
    .
    Where is “the configuration field concurrencyMode”? Even searching the codebase, the only place I can find “concurrencyMode” is in the docs.
    • 1
    • 1
  • d

    Davio

    02/27/2023, 12:56 PM
    Hello everyone, I'm not sure which framework to blame, but I can't get test filtering working with Kotest, Maven Failsafe and Tags, given a simple example like this:
    package com.example.demo
    
    import io.kotest.core.spec.style.ShouldSpec
    import org.junit.jupiter.api.Tag
    import org.junit.jupiter.api.fail
    
    @Tag("IntegrationTests")
    class IntegrationIT : ShouldSpec({
    
        should("fail") {
            fail { "fail" }
        }
    })
    This test will always be run by failsafe, even if I specify the groups/tags to run to be something else
    s
    • 2
    • 4
  • a

    Alexandre Brown

    02/27/2023, 3:44 PM
    Hello, is there a way to group multiple tests that follow the
    StringSpec
    a bit like we an use InnerClass with JUnit5? What I have :
    "myMethod does ABC when 123" { 
    
    }
    
    "myMethod does XYZ when 666" {
    
    }
    What I want :
    "myMethod" { 
        "does ABC when 123" {
    
        }
        "does XYZ when 666" {
    
        }
    }
    s
    e
    l
    • 4
    • 5
  • f

    Franklin

    02/27/2023, 9:16 PM
    Hey so I'm making use of https://kotest.io/docs/framework/datatesting/data-driven-testing.html What would be the best way to run individual tests? My list of tests and test names are stable. (See picture) when I right click a test I can't rerun a specific test. These tests are also from files, I would love to be able to double click the test name and for the file to open up. There's a
    Rerun Failed Tests
    button which is also useful, but I'm not sure how the failed test names are fed in so I can filter the tests being run. Thanks. Edit: I just realized I've been using a for loop over my input and just calling
    test
    multiple times. I tried
    withData
    and it's the same.
  • x

    xenomachina

    02/28/2023, 8:01 PM
    If using
    InstancePerTest
    or
    InstancePerLeaf
    , does
    autoClose(x)
    close x when the spec class is finished (ie: all of the tests in the spec have completed) or when the specific spec instance is finished?
    s
    • 2
    • 3
  • a

    abendt

    03/02/2023, 9:00 AM
    hi folks, while working on a project that uses the http4k kotest matchers we found that its a bit hard to re-use kotests json matchers. So we have made some changes to the json matchers to make it easier to re-use them. I hope that change is acceptable and can me merged
    e
    • 2
    • 2
  • m

    Moritz Post

    03/03/2023, 8:36 AM
    hello. I am facing a "possibly" simple issue. How would i initialise the class under test before each test run in a ShouldSpec test? I have a test like the one below but i do not know how to correctly initialize the
    engine
    . I don't want to change the isolation mode as i would like to do some other data loading once upfront (to feed the engine).
    class EngineTest : ShouldSpec({
    
        val engineInput = loadExpensiveInput()
    
        // does not work and lateinit is not available
        var engine: Engine
        
        beforeEach {
            engine = Engine(engineInput)
        }
    
        should("be ready") {
            engine.ready shouldBe true
        }
    }
    d
    • 2
    • 12
  • m

    Moritz Post

    03/03/2023, 8:41 AM
    Something like the following would be nice.
    val engine by beforeEach { Engine(engineInput) }
  • m

    Michael Vandendriessche

    03/03/2023, 10:41 AM
    Hi everyone! I would like to know if anyone here used Kotest on an Android app with Hilt (DI framework) and what your experiences were. I don't see much content online about the two of them together. I don't have experience in either, besides creating the first few classes in separate projects. Did anyone have any compatibility issues?
    l
    • 2
    • 3
  • k

    Kirill Zhukov

    03/03/2023, 9:57 PM
    My common tests don’t seem to be running at all when targeting ios specifically: •
    jvmTest
    runs
    commonTest
    targeting JVM and runs tests •
    iosSimulatorArm64Test
    doesn’t seem to compile/run
    commonTest
    targets iOS target 🤔 I have
    framework-engine
    dependency added to
    commonTest
    , anything I might be missing?
    a
    • 2
    • 5
  • k

    Kirill Zhukov

    03/04/2023, 1:55 AM
    @kierans777, I’m seeing the same problem were you able to resolve this?
    • 1
    • 1
Powered by Linen
Title
k

Kirill Zhukov

03/04/2023, 1:55 AM
@kierans777, I’m seeing the same problem were you able to resolve this?
https://kotlinlang.slack.com/archives/CT0G9SD7Z/p1677880631728359
View count: 12