← All courses

Testing & Publishing

🗓 May 31, 2026 ⏱ 1 min read

Shared tests

Because logic lives in commonMain, you write tests once in commonTest and they run on every platform.

class MathTest {
    @Test
    fun addsNumbers() {
        assertEquals(4, add(2, 2))
    }
}

Using shared code in each app

  • Android — add the shared module as a Gradle dependency and call it directly.
  • iOS — the shared module compiles to a native framework that Swift imports like any other library.

Build & ship

Build the Android app with Gradle and the iOS app in Xcode as usual — the shared logic is already inside both. Publish each to its store normally.

Big picture: KMP removes duplicated logic and bugs across platforms while letting each app feel 100% native to its users.