https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
h

hmole

10/16/2018, 12:04 PM
Are there any examples of sharing code between
commonTest
and
androidTest
from another module?
1
g

gildor

10/16/2018, 2:31 PM
The only way to do that, create a new common module (code should be in main source set), then just use it as dependency for both
h

hmole

10/17/2018, 4:47 AM
So I have to create 3 separate modules.
test
that depends on my
core
module. Then
test-android
and
test-ios
, which both will depend on the first two? Sad state of affairs if it's like that.
g

gildor

10/17/2018, 5:51 AM
Not sure about “`test` that depends on my
core
module”
I thought that you want to share some code between android-only and common tests If so, you just need one more common module, something like “common-test-utils” that used by any test modules
h

hmole

10/17/2018, 9:27 AM
But how would I write that code if I don't have dependency on common code that I want to test?
g

gildor

10/17/2018, 9:28 AM
Maybe i don’t understand your case. What is “sharing code between
commonTest
and `androidTest`“?
h

hmole

10/17/2018, 9:41 AM
I have default mpp module with most functionality in
commonMain
module. I want to test it in android instrumentation tests because android side of the
commonMain
needs context. To do that I need to create separate
android.application
module and somehow get the actual tests from whatever common module has them. I also want to run ios tests from
iosTest
. Question: how do I share tests between ios tests and android instrumentation tests in another module?
I've tried many setups with different dependency configurations. Closest i've gotten is that
androidTest
doesn't have
commonMain
classes in it's classpath, but ide recoginzes them.