kmm-testing

Provide standardized Kotlin Multiplatform testing patterns for commonTest, androidUnitTest, and iosTest.

1|Updated Apr 24, 2026
One-click install
npx skills add https://github.com/dimitriRemoiville/cc-mobile --skill kmm-testing
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: kmm-testing
Source: https://github.com/dimitriRemoiville/cc-mobile/tree/main/plugins/cc-mobile-kmm/skills/kmm-testing
Command: npx skills add https://github.com/dimitriRemoiville/cc-mobile --skill kmm-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Streamlines the creation of robust, cross-platform tests for the Kotlin Multiplatform module by providing reusable patterns for commonTest, androidUnitTest, and iosTest, including HTTP mocking with Ktor MockEngine.

Core Features & Use Cases

  • Cross-platform testing patterns: guidance for commonTest, androidUnitTest, and iosTest across JVM and Native targets.
  • ViewModel and Use Case testing: sample patterns for testing UseCases and ViewModels with coroutines, including setMain dispatcher.
  • HTTP mocking with MockEngine: guidance on using Ktor MockEngine for network-reliant tests, plus avoiding MockK in commonTest.
  • Best practices: avoid thread sleep, use runTest, and deterministic testing with injected clocks.

Quick Start

Create a commonTest baseline using kotlin.test and kotlinx-coroutines-test, then adapt tests for Android and iOS targets.

Frequently Asked Questions about kmm-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Kotlin Multiplatform tests for both JVM and iOS targets?▼

To write Kotlin Multiplatform tests for JVM and iOS, apply standardized testing patterns across commonTest, androidUnitTest, and iosTest using kotlin.test and kotlinx-coroutines-test to verify UseCases, ViewModels, and Ktor repositories.

Why should I avoid MockK in commonTest for KMM projects?▼

You should avoid MockK in commonTest because it lacks full Kotlin Multiplatform support; instead, use Ktor MockEngine for network mocking and standard kotlin.test assertions to ensure cross-platform test compatibility.

What is the best way to test Ktor repositories in a Kotlin Multiplatform module?▼

The best way to test Ktor repositories in a Kotlin Multiplatform module is using Ktor MockEngine to mock HTTP responses, combined with deterministic testing patterns like injected clocks and runTest for coroutine execution.

How do I test ViewModels with coroutines in KMM without using thread sleep?▼

To test ViewModels with coroutines in KMM without thread sleep, use kotlinx-coroutines-test with runTest and setMain dispatcher to control asynchronous execution deterministically across commonTest and platform-specific test suites.

Does this KMM testing approach support both androidUnitTest and iosTest scenarios?▼

Yes, this KMM testing approach supports both androidUnitTest and iosTest scenarios by providing reusable cross-platform testing patterns that standardize coroutine dispatcher setup and HTTP mocking across JVM and Native targets.