kotlin-testing-kmp

Design, implement, and review Kotlin Multiplatform tests across shared and platform-specific code.

1|Updated Apr 2, 2026
One-click install
npx skills add https://github.com/leogallego/ansible-jane --skill kotlin-testing-kmp-leogallego
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kotlin-testing-kmp
Source: https://github.com/leogallego/ansible-jane/tree/main/skills/kotlin-testing-kmp
Command: npx skills add https://github.com/leogallego/ansible-jane --skill kotlin-testing-kmp-leogallego

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Kotlin Multiplatform testing strategy and guidelines for designing, implementing, and reviewing tests across shared and platform-specific code in KMP projects. This guide helps teams ensure fast feedback, robust test coverage, and clear separation between local, Robolectric, instrumented, and UI tests while maintaining a practical approach to test doubles and performance.

Core Features & Use Cases

  • Provides recommended testing pyramid shape, with emphasis on shared logic tested in commonTest using kotlin.test and platform-specific tests for Android or native targets.
  • Outlines best practices for local unit tests, instrumented tests, Robolectric usage, Compose Multiplatform UI tests, and screenshot testing.
  • Defines criteria for when to place tests in commonTest vs platform-specific modules and how to structure test doubles (fake, stub, mock, spy).

Quick Start

Run the shared tests in commonTest and verify cross-platform behavior with Kotlin Multiplatform test utilities.

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 Kotlin Multiplatform tests across shared and platform-specific code?

Structure Kotlin Multiplatform tests by placing shared logic in commonTest using kotlin.test, and platform-specific tests in Android or native modules. This separation maintains fast feedback and robust coverage across JVM, Native, and JS targets.

What is the recommended testing pyramid for Kotlin Multiplatform projects?

The recommended testing pyramid for Kotlin Multiplatform emphasizes a broad base of shared logic tested in commonTest, ascending to fewer platform-specific and instrumented tests, ensuring fast feedback and practical coverage for JVM, Native, and JS targets.

How do I run Compose Multiplatform UI tests and screenshot tests?

Run Compose Multiplatform UI tests and screenshot tests by following best practices for instrumented tests, ensuring clear separation from local unit tests to maintain stability and performance across different platform targets.

When should I use Robolectric versus instrumented tests in a KMP project?

Use Robolectric for local JVM-based tests requiring Android framework dependencies when fast feedback is needed, and reserve instrumented tests for validating actual device behavior, maintaining a disciplined separation between local and device testing.

What test doubles should I use for Kotlin Multiplatform testing?

Use test doubles like fake, stub, mock, and spy based on specific isolation needs. Apply disciplined selection criteria to ensure tests remain maintainable and performant across shared commonTest and platform-specific modules.

Does kotlin.test work across all KMP targets including Native and JS?

Yes, kotlin.test works across JVM, Native, and JS targets. It is the recommended framework for commonTest, allowing you to verify cross-platform behavior uniformly within your Kotlin Multiplatform project.