0Pricing
Kotlin Multiplatform Academy · Lesson

Run Tests on Android & iOS Targets

Execute the suite across every platform.

Run Tests on Android & iOS Targets is a free Kotlin Multiplatform Academy lesson on CoddyKit — lesson 4 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Kotlin Multiplatform Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

One Suite, Every Target

A common test compiles for each platform, so you can run the exact same suite on Android and on iOS. 🚀

Gradle Drives It All

You launch tests through Gradle tasks, each one tied to a specific platform target of your shared module.

Run the Android Tests

The testDebugUnitTest task runs your common and JVM tests on the local JVM, no emulator needed.

./gradlew :shared:testDebugUnitTest

Run on the iOS Simulator

A target-named task runs the same shared tests on the iOS simulator via Kotlin/Native's runner.

./gradlew :shared:iosSimulatorArm64Test

Pick the Right Arch

The iOS task name encodes the architecture, so Apple Silicon uses iosSimulatorArm64 while older setups differ.

Run Everything at Once

Calling the broad allTests task executes every target's suite in a single command.

./gradlew :shared:allTests

Reading the Report

Gradle writes an HTML report under build/reports, showing which case failed on which platform.

Catch Platform Drift

Running on both targets reveals subtle differences, like number formatting, before they reach your users.

iOS Tests Need a Mac

The iOS simulator target only runs on macOS with Xcode installed, while JVM tests run anywhere.

Wire It Into CI

In CI, run the JVM tests on any runner and the iOS suite on a macOS runner to cover everything.

Green on Both Means Done

When the suite passes on Android and iOS, you have real confidence that shared logic behaves identically. ✅

Quick Check

Pick the Android test task.

Recap

Use Gradle tasks per target: testDebugUnitTest for Android and iosSimulatorArm64Test for iOS, or allTests for both.

Frequently asked questions

Is the “Run Tests on Android & iOS Targets” lesson free?

Yes — the full text of “Run Tests on Android & iOS Targets” is free to read here on the web, and the Kotlin Multiplatform Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Kotlin Multiplatform Academy course, upgrade to CoddyKit PRO.

What will I learn in “Run Tests on Android & iOS Targets”?

Execute the suite across every platform. You practise Kotlin Multiplatform Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Kotlin Multiplatform Academy?

No prior experience is required. Kotlin Multiplatform Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 4 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Run Tests on Android & iOS Targets” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Kotlin Multiplatform Academy lesson?

Yes. Every Kotlin Multiplatform Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. kotlin.test in commonTest
  2. Test suspend Functions & Flows
  3. Fake the Ktor Client & Repos
  4. Run Tests on Android & iOS Targets
← Back to Kotlin Multiplatform Academy