Thread
#multiplatform
    i

    Igor Milakovic

    6 months ago
    How do you guys run your tests in the shared module? I was following this article but it doesn't quite work as expected:https://touchlab.co/understanding-and-configuring-your-kmm-test-suite/ The suggested
    ./gradlew :shared:allTests
    does not run Android tests. That's not that big of a deal, since
    ./gradlew :shared:check
    does run both. But the problem is that running any of those repeatedly doesn't fail any longer when iOS tests fail. Luckily, can be fixed by adding
    :shared:clean
    before
    :shared:check
    but then it doesn't proceed with Android tests after iOS fails... And so on, haha. So yeah, how do you people run your tests, what is the magic command/configuration? 🙂 Thanks!
    Matti MK

    Matti MK

    6 months ago
    You can run
    ./gradlew tasks --all
    to show all tasks. I run:
    :shared:iosTest
    -> “Executes Kotlin/Native unit tests for target ios.” and
    :shared:testDebugUnitTest
    -> “Run unit tests for the debug build” (this one runs only for Android)
    If you run
    ./gradlew :shared:allTests --dry-run
    you can see the list of tasks that are executed for that given task. For me there’s no indications about running any Android related tests
    Javier

    Javier

    6 months ago
    Looks like a bug with Gradle cache that should be reported to the Kotlin team
    m

    mkrussel

    6 months ago
    allTests
    are all tests except for Android with Android being a special and having multiple test tasks of its own created by the AGP. Since each platform's tests are different task, gradle does stop after the first task failure unless you use
    --continue
    , But that will also make it try to continue on compile failures, so I'm not a fan of using it. I'm not sure if not running the
    iosTest
    with no changes is a bug with cache. You can run
    cleanAllTests
    to clean the non Android tests and force them to be run again.
    Javier

    Javier

    6 months ago
    if running check fails and rerunning it passes, it is a bug
    m

    mkrussel

    6 months ago
    I would agree with that, if the task failed it should not get cached or it needs to cache the failure status.
    i

    Igor Milakovic

    6 months ago
    Thanks guys, this was very helpful! Much appreciated 🙂