kotlin-testing-kmp

Design and review Kotlin Multiplatform testing strategies across commonTest and platform-specific source sets.

63|6|Updated Mar 27, 2026
One-click install
npx skills add https://github.com/mmiani/kotlin-kmp-claude-agent-skills --skill kotlin-testing-kmp-mmiani
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-testing-kmp
Source: https://github.com/mmiani/kotlin-kmp-claude-agent-skills/tree/main/skills/kotlin-testing-kmp
Command: npx skills add https://github.com/mmiani/kotlin-kmp-claude-agent-skills --skill kotlin-testing-kmp-mmiani

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Testing across Kotlin Multiplatform projects is complex due to shared and platform-specific code; this skill codifies best practices to ensure fast, reliable, and maintainable test suites.

Core Features & Use Cases

  • Shared testing philosophy: encourage commonTest usage with kotlin.test for cross-target validation.
  • Testing pyramid guidance: emphasize local unit tests, selective instrumented/UI tests, and guarded integration tests.
  • KMP-specific tooling guidance: delineate platform boundaries and test doubles strategies for shared logic.

Quick Start

Create a shared commonTest suite with kotlin.test assertions and start adding platform-specific tests as needed.

Frequently Asked Questions about kotlin-testing-kmp

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

FAQPage Schema
How do I structure unit tests for Kotlin Multiplatform shared code?

Structure Kotlin Multiplatform unit tests by placing cross-platform validation logic in the commonTest source set using the kotlin.test library. This ensures shared code is validated consistently across all targets before adding platform-specific tests.

What is the recommended testing pyramid for Kotlin Multiplatform projects?

The recommended testing pyramid for Kotlin Multiplatform emphasizes fast local unit tests in commonTest, selective instrumented and UI tests, and guarded integration tests to ensure stability and maintainability across shared and platform-specific source sets.

Can I use Robolectric for instrumented tests in a Kotlin Multiplatform project?

Yes, Robolectric can be used for instrumented tests in Kotlin Multiplatform projects. This skill guides the setup of Robolectric and instrumented tests specifically for platform-specific source sets to validate Android-dependent shared logic.

How do I manage test doubles for shared logic in Kotlin Multiplatform?

Manage test doubles in Kotlin Multiplatform by delineating platform boundaries within your shared logic. This skill provides strategies for implementing test doubles that isolate commonTest code from platform-specific dependencies for reliable cross-target validation.

Does this skill cover Compose Multiplatform UI and screenshot testing?

Yes, this skill covers Compose Multiplatform UI and screenshot testing. It provides best practices for designing UI tests and capturing screenshot tests to validate shared interfaces across different platform targets.

When should I write platform-specific tests instead of commonTest in KMP?

Write platform-specific tests instead of commonTest in Kotlin Multiplatform when validating platform-dependent implementations or setting up instrumented tests. Use commonTest with kotlin.test for shared logic, and add platform tests as needed for boundaries.