Hi, i want to add unit test to my multiplatform project. I'm using the new stucture with Mobile iOS/android. Is it possible to write unit tests in commonTest module? If so how do I do that?
j
Jurriaan Mous
11/09/2018, 10:57 AM
Yes. And the default iOS/Android project in Intellij Idea has a common unit test which you can run with the test gradle task.
And you need to use the kotlin.test common package
First of all, thank you. But i'm confused, I already added kotlin test common package. Then I tried to run the gradle task test, but i got the error: Task 'test' not found in project ':SharedCode'. So I wondered if it even possible.
j
Jurriaan Mous
11/09/2018, 11:13 AM
Test needs to be run from a platform. Does your shared code have targets? I have within the common code a test task for each specific platform.
The Android/iOS default project seems a bit different since it only has a test task.
s
Sabrina Namur
11/09/2018, 11:25 AM
Yes, i have android and iOS as targets. I'm not familiar with gradle and i think i have to adjust my gradle task. Thanks.