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

zsperske

07/05/2020, 6:55 PM
Does anyone know what gradle command I should be running to run tests from "commonTest"? I'm using
Kotlin.test.Test
annotations and when I try to right click and run from Intellij it generates this test command which looks wrong
cleanIosTest iosTest --tests "tests.MyTest.test
, I've tried changing the command to just
test --tests "tests.MyTest.test
to no avail
a

andylamax

07/05/2020, 7:00 PM
That is expected. Even common test. have to run on a specific platform. Writing common tests doesn't mean that you can test them in a no specific environment. It means they will be tested in every environment. That being said, when you execute
iosTest
, all test from ios and common will be tested on an ios environment. Similarly, when you execute
jvmTest
all test from jvmTest and common will be run on a jvm environment. So, In short, you can run commonTest in an environment of your choosing
z

zsperske

07/05/2020, 7:10 PM
do I need to include the test dependencies in my other targets?
when running just a straight
./gradlew test
at the top level
I see unresolved reference errors when
*> Task :SharedCode:compileDebugUnitTestKotlinAndroid* FAILED
runs
yup I needed to include
implementation kotlin('test')
in an
androidTest.dependencies
block, thanks for your help @andylamax!
a

andylamax

07/05/2020, 7:55 PM
You are welcome
2 Views