touchlab / KaMPKit

KaMP Kit by Touchlab. A collection of code & tools designed to get your mobile team started quickly w/Kotlin Multiplatform
https://touchlab.co/
Apache License 2.0
2.2k stars 199 forks source link

Running unit test from commonTest folder only runs the iOS test gradle task #169

Closed abhishekdewan101 closed 3 years ago

abhishekdewan101 commented 3 years ago

Issue

When I run the unit test from the commonTest folder it seems to be running the iOS test gradle task. I have tried to attach screen shots of how I am trying to run the unit test in android studio.

As far as I can understand from the docs the common unit tests need to be run twice one on the android platform and one on iOS.

For instance when I run the BreedModelTest it uses a testDbConnection method to get the SQLDriver from the various platforms. To me it seems like that when I run the test it should also test getting the driver from android and run the tests essentially twice. I might be wrong here in my assumption since I am pretty new to KMM.

As can be seen from the screen shots the resulting gradle task that is created when I follow this method of running the test also only runs the iOS gradle commands for some reason.

Configurations

  1. Using the latest master code.
  2. Android Studio 4.2 Beta 4.
  3. Mac OS 11.2 Big Sur

Screenshots

Screen Shot 2021-02-03 at 11 45 23 PM Screen Shot 2021-02-03 at 11 45 33 PM Screen Shot 2021-02-03 at 11 45 44 PM
russhwolf commented 3 years ago

This is fixed in Intellij but hasn't made it to Android Studio yet. It might be fixed in the latest canary but I haven't checked. See https://youtrack.jetbrains.com/issue/KT-42463

abhishekdewan101 commented 3 years ago

@russhwolf Awesome! I can try this with Intellij and report back !

abhishekdewan101 commented 3 years ago

Can confirm that when using latest IntelliJ (2020.3) I can see the option to run tests for iOS and Android

image