https://kotlinlang.org logo
Join SlackCommunities
Powered by
# kotlintest
  • a

    AJ Alt

    01/23/2020, 10:12 PM
    Awesome, I'll try out the snapshot
  • s

    sam

    01/23/2020, 10:14 PM
    will release a proper beta by the end of the month
    👍 3
  • v

    Vitali Plagov

    01/27/2020, 2:44 PM
    Does anyone have an example of how to use
    kotest-extensions-allure
    for Allure Report framework with Kotlintest? https://github.com/kotlintest/kotlintest/tree/master/kotest-extensions/kotest-extensions-allure This module is missing documentation…
  • a

    AJ Alt

    01/30/2020, 7:14 PM
    Was there supposed to be a 3.4.3 release? I see a tag for it, but it's not listed in the changelog or present in maven. https://github.com/kotlintest/kotlintest/releases/tag/3.4.3
  • s

    sam

    01/30/2020, 7:19 PM
    not sure it was ever released
  • a

    AJ Alt

    02/03/2020, 9:40 PM
    Looks like everything's working. Snapshots are now published on all platforms (jvm, js, native linux, windows, and macOS): https://oss.sonatype.org/content/repositories/snapshots/io/kotest/kotest-assertions-js/4.0.0.19-SNAPSHOT/ https://oss.sonatype.org/content/repositories/snapshots/io/kotest/kotest-assertions-jvm/4.0.0.19-SNAPSHOT/ https://oss.sonatype.org/content/repositories/snapshots/io/kotest/kotest-assertions-linuxx64/4.0.0.19-SNAPSHOT/ https://oss.sonatype.org/content/repositories/snapshots/io/kotest/kotest-assertions-macosx64/4.0.0.19-SNAPSHOT/ https://oss.sonatype.org/content/repositories/snapshots/io/kotest/kotest-assertions-mingwx64/4.0.0.19-SNAPSHOT/
    👍 1
  • s

    sam

    02/03/2020, 9:41 PM
    awesome
  • s

    sam

    02/03/2020, 9:41 PM
    that’s really nice
  • s

    Sam Garfinkel

    02/12/2020, 5:15 PM
    Is there a non-reified version of shouldBeInstanceOf/shouldBeTypeOf so you can pass in a variable for the KClass? Useful for data-driven testing where you want to pass a class as one of the row inputs.
  • s

    Sam Garfinkel

    02/12/2020, 5:19 PM
    There’s a matcher
    beOfType(expected: KClass<*>)
    which does this, so I guess you can just use
    shouldBe beOfType(clazz)
    c
    • 2
    • 1
  • m

    Mike

    02/12/2020, 5:30 PM
    Am I missing something in the Assertions, or not using them correctly? I'm used to AssertJ, and it's very descriptive messages when things don't match. Kotlintest's assertions seem to only tell me that the condition wasn't met, but no explanation/descriptions. Is there a way to have them be descriptive, or should I adopt AssertJ/Atrium instead? I just really like the
    actual shouldBe expected
    format vs
    expect(actual) shouldBe expected
    format required by the other two.
  • l

    LeoColman

    02/12/2020, 5:31 PM
    Which matchers are you using that don't have a good message?
  • m

    Mike

    02/12/2020, 5:33 PM
    Collections.
  • l

    LeoColman

    02/12/2020, 5:34 PM
    Could you give us an example?
  • m

    Mike

    02/12/2020, 5:38 PM
    events.shouldContainAll(OrderPlaced(pricedOrder))
    just tells me that
    Collection should contain all
    and then does
    toString()
    on all the items in the expected collection. Feature Request required here? I know it's not easy to do this, so not surprised if it hasn't been done yet.
  • a

    Ashish Kumar Joy

    02/12/2020, 6:19 PM
    @Mike we had improved error message of that matcher in https://github.com/kotlintest/kotlintest/pull/980 now we do show which all items are not present in collection, but currently this is not released and will be available in next release. https://github.com/kotlintest/kotlintest/blob/master/kotest-assertions/src/commonMain/kotlin/io/kotest/matchers/collections/CollectionMatchers.kt#L31
  • m

    Mike

    02/12/2020, 6:54 PM
    Awesome! Just keeps getting better and better. Thank you.
    s
    • 2
    • 1
  • t

    taer

    02/13/2020, 9:23 PM
    Hi. Just accidentally discovered that StringSpec's testContexts can call suspendable functions. That was awesome. One quick question. One small test has an
    assertAll(Gen.string(), <http://Gen.int|Gen.int>())
    call, which loses the context. I've temporarily wrapped the suspend call in a runBlocking, but any advice on how to address that?
    s
    • 2
    • 2
  • d

    dave08

    02/16/2020, 3:41 PM
    If I have many describe sections in one test class, and one of them has multiple `it`s without
    context
    , is it expected that only the first one gets run?
  • d

    dave08

    02/16/2020, 3:47 PM
    And when I run it by itself (with the plugin), it passes even though the assertion exception was thrown.
    s
    • 2
    • 1
  • d

    dave08

    02/16/2020, 3:54 PM
    @LeoColman?
  • s

    sam

    02/16/2020, 6:47 PM
    set the channel topic: Kotlintest is now Kotest. Please try Kotest 4.0 beta 1 from maven and feedback issues!
  • s

    sam

    02/16/2020, 6:49 PM
    Kotest 4.0 beta1 has been released
  • s

    sam

    02/16/2020, 6:54 PM
    Please migrate all conversation from here to #kotest. Please don't add further comments so that this message stays at the bottom!
  • k

    Kavita

    10/02/2020, 5:27 PM
    Hello everyone, I am facing one issue related to test cases. My Android project has more than 250 tests. Most of them include API mocking & some of them are unit tests. In Android Studio when I run the individual test class, all tests in that class succeed. But when I run the entire test package(altogether), some of the tests fail randomly. The project has
    MockWebSerever
    &
    Awaitility
    to handle API mocking & async operation. The
    .gradle
    file also has Android Orchestrator & clearPackageData declared. Still, the issue persists. Can someone help me to fix this issue?
    d
    • 2
    • 2
  • i

    iamthevoid

    04/28/2021, 11:52 AM
    Hi, everyone! I met strange issue when trying to run tests in multiplatform project At first i’ve add dependencies in
    commonTest
    module
    Copy code
    val commonTest by getting {
                dependencies {
                    // shared test code because tests placed in features
                    implementation(project(":lib:shared-test"))
    
                    // kotlin deps
                    implementation(kotlin("test-common"))
                    implementation(kotlin("test-annotations-common"))
                    
                    // ktor test dep to mock responses
                    implementation(Dependencies.Ktor.testing)
                }
            }
    then i’ve add simple test
    Copy code
    import kotlin.test.Test
    import kotlin.test.assertEquals
    
    class TestCase {
    
        @Test
        fun test() {
            assertEquals(3, 1 + 2)
        }
    }
    But when I try run it i am getting
    Copy code
    e: TestCase.kt: (3, 20): Unresolved reference: Test
    e: TestCase.kt: (4, 20): Unresolved reference: assertEquals
    e: TestCase.kt: (16, 6): Unresolved reference: Test
    e: TestCase.kt: (18, 9): Unresolved reference: assertEquals
    and message
    test events were not received
    Why can it be?
    s
    • 2
    • 3
  • a

    Alexander Weickmann

    01/25/2023, 3:14 PM
    Hi all. Is it possible to run tests in parallel on a per test-method basis by using only kotlin-test and gradle? So far I was able to implement my tests without adding an additional dependency to an engine like junit-jupiter. Do I need to add this explicit dependency now so I can run tests in parallel, or is there a pure kotlin solution?
  • h

    Hariharasudhan D

    07/11/2023, 9:26 AM
    Hello Guys, Is there any way to run Espresso UI test in release build variant
  • k

    Kashismails

    04/18/2024, 10:43 AM
    hi all, i have a multimodule kmp app and my tests are written in all modules, what is the gradle command to run all the tests from different modules? currently i am able to run test for one module but not all at once
  • p

    pitpit

    09/26/2024, 4:00 PM
    Hi, I've got error. Someone has this error too ? l`ateinit property scene has not been initialized`
    kotlin.UninitializedPropertyAccessException: lateinit property scene has not been initialized
    When i run desktopTest for composeUiTest It's fixed after upgrade compose plugin to 1.7.0-beta02 but it broke unit test that access Res. and robolectric. (
    Android context is not initialized. If it happens in the Preview mode then call PreviewContextConfigurationEffect() function
    .) (modifié)