dimitriremoiville/cc-mobile/kmm-testing
Claude Code and agent skill by dimitriremoiville/cc-mobile
- community
Checking that the SKILL.md file is still in the repository.
Testing patterns for the shared Kotlin Multiplatform module — `kotlin.test` + `kotlinx-coroutines-test`. Covers use cases, ViewModels, Ktor repositories (with MockEngine), and how to keep tests running on both JVM and iOS simulator targets.
Install
npx vskill@latest install dimitriremoiville/cc-mobile/kmm-testingSKILL.md
The same SKILL.md was published earlier as dimitriremoiville/cc-mobile/kmm-testing.
KMM testing
Stack
- Assertions:
kotlin.test(assertEquals,assertTrue,assertFailsWith,assertIs,assertNotNull). - Coroutines:
kotlinx-coroutines-test(runTest,TestDispatcher,advanceUntilIdle). - Ktor:
MockEnginefromktor-client-mock— multiplatform, no real network.
This skill deliberately stays within those two (plus MockEngine when the test touches an HttpClient). MockK is JVM-only — don't reach for it in commonTest.
Where tests live
Default to commonTest. Promote a test to a platform test set only when the code under test is also platform-specific.
Use case tests
ViewModel tests
ViewModels use viewModelScope, which requires Dispatchers.Main to be set. Use Dispatchers.setMain(dispatcher) in @BeforeTest, reset in @AfterTest. This works in commonTest on both JVM and Native (the Native test runtime supports it).
Pattern:
StandardTestDispatcher(notUnconfinedTestDispatcher) for realistic scheduling.runTest(dispatcher)drives the same test dispatcher.advanceUntilIdle()after triggering work; then assert.- No Turbine needed —
state.valueis the current StateFlow value.
Ktor repository tests (MockEngine)
MockEngine lets you assert on the request and script the response — everything stays in commonTest.
Hand-rolled fakes
- Add state only as the test needs.
- Spy on calls by recording them.
- Don't reach for MockK in
commonTest.
Rules of thumb
- One concept per test. Long tests with five loosely-related assertions are a smell.
- No real IO. Ktor: MockEngine. SQLDelight: skip or use its in-memory driver in
commonTest. No real filesystem. - Deterministic time. Inject a
Clock(kotlinx.datetime.Clock) or() -> Instant; don't callClock.System.now()in production without a seam. - Name tests as sentences.
returnsOrderWhenRepositoryAccepts(). - `commonTest` first. Promote out only when necessary.
Run tests
Don'ts
- No JUnit imports in
commonTest— usekotlin.test.*. - No
MockKincommonTest— it's JVM-only. - No
Thread.sleepor baredelayoutsiderunTest. - No
runBlocking— userunTest. - No test depending on another test's side effects.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/cc-mobile-kmm/skills/kmm-testing/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dimitriremoiville/cc-mobile/kmm-testing)