Hi, i want to add unit test to my multiplatform pr...
# multiplatform
s
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
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
s
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
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
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.
t