Compose Multiplatform Patterns
monta-app/ocpp-emulator
Compose Multiplatform and Jetpack Compose patterns for KMP projects — state management, navigation, theming, performance, and platform-specific UI.
A skill your agent uses to test suspend functions and coroutine-using classes on the JVM with kotlinx-coroutines-test.
$ npx skills add skydoves/android-testing-skills --skill testing-coroutines-with-runtest -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install skydoves/android-testing-skills testing-coroutines-with-runtest --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/skydoves/android-testing-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/jvm-tests/coroutines/testing-coroutines-with-runtest .claude/skills/testing-coroutines-with-runtest && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "testing-coroutines-with-runtest" agent skill from https://github.com/skydoves/android-testing-skills/tree/main/jvm-tests/coroutines/testing-coroutines-with-runtest into .claude/skills/testing-coroutines-with-runtest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-coroutines-with-runtest", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/skydoves/android-testing-skills/tree/main/jvm-tests/coroutines/testing-coroutines-with-runtestType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add skydoves/android-testing-skills --skill testing-coroutines-with-runtest -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install skydoves/android-testing-skills testing-coroutines-with-runtest --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/skydoves/android-testing-skills.git skills-src && mkdir -p .agents/skills && cp -r skills-src/jvm-tests/coroutines/testing-coroutines-with-runtest .agents/skills/testing-coroutines-with-runtest && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "testing-coroutines-with-runtest" agent skill from https://github.com/skydoves/android-testing-skills/tree/main/jvm-tests/coroutines/testing-coroutines-with-runtest into .agents/skills/testing-coroutines-with-runtest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-coroutines-with-runtest", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add skydoves/android-testing-skills --skill testing-coroutines-with-runtest -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install skydoves/android-testing-skills testing-coroutines-with-runtest --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/skydoves/android-testing-skills.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/jvm-tests/coroutines/testing-coroutines-with-runtest .cursor/skills/testing-coroutines-with-runtest && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "testing-coroutines-with-runtest" agent skill from https://github.com/skydoves/android-testing-skills/tree/main/jvm-tests/coroutines/testing-coroutines-with-runtest into .cursor/skills/testing-coroutines-with-runtest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-coroutines-with-runtest", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/skydoves/android-testing-skills.git --path jvm-tests/coroutines/testing-coroutines-with-runtest--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add skydoves/android-testing-skills --skill testing-coroutines-with-runtest -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install skydoves/android-testing-skills testing-coroutines-with-runtest --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/skydoves/android-testing-skills.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/jvm-tests/coroutines/testing-coroutines-with-runtest .gemini/skills/testing-coroutines-with-runtest && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "testing-coroutines-with-runtest" agent skill from https://github.com/skydoves/android-testing-skills/tree/main/jvm-tests/coroutines/testing-coroutines-with-runtest into .gemini/skills/testing-coroutines-with-runtest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-coroutines-with-runtest", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install skydoves/android-testing-skills testing-coroutines-with-runtestInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add skydoves/android-testing-skills --skill testing-coroutines-with-runtest -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/skydoves/android-testing-skills.git skills-src && mkdir -p .github/skills && cp -r skills-src/jvm-tests/coroutines/testing-coroutines-with-runtest .github/skills/testing-coroutines-with-runtest && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "testing-coroutines-with-runtest" agent skill from https://github.com/skydoves/android-testing-skills/tree/main/jvm-tests/coroutines/testing-coroutines-with-runtest into .github/skills/testing-coroutines-with-runtest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-coroutines-with-runtest", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add skydoves/android-testing-skills --skill testing-coroutines-with-runtest -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install skydoves/android-testing-skills testing-coroutines-with-runtest --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/skydoves/android-testing-skills.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/jvm-tests/coroutines/testing-coroutines-with-runtest .opencode/skills/testing-coroutines-with-runtest && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "testing-coroutines-with-runtest" agent skill from https://github.com/skydoves/android-testing-skills/tree/main/jvm-tests/coroutines/testing-coroutines-with-runtest into .opencode/skills/testing-coroutines-with-runtest/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "testing-coroutines-with-runtest", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
testing-coroutines-with-runtestA skill your agent uses to test suspend functions and coroutine-using classes on the JVM with kotlinx-coroutines-test.
Testing Coroutines With Runtest is an agent skill from skydoves/android-testing-skills. Use this skill to test suspend functions and coroutine-using classes on the JVM with kotlinx-coroutines-test. Covers runTest, TestScope, StandardTestDispatcher vs UnconfinedTestDispatcher, virtual time via TestCoroutineScheduler (advanceTimeBy, advanceUntilIdle, runCurrent), the canonical MainDispatcherRule wrapper for Dispatchers.setMain/resetMain, the TestResult Promise contract on KMP, and the runBlockingTest - runTest migration. If the user mentions runTest, runBlockingTest deprecated, advanceUntilIdle…
Its SKILL.md is about 5.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Mobile. It works with Kotlin. The repository describes itself as: ⚡️ A set of skills for Android testing: Compose UI, AndroidX Test, JVM unit tests, and ADB. The licence is Apache-2.0.
3 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 8665ed5. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
No scripts in the folder and no shell commands in SKILL.md (its code samples are kotlin).
From the folder's file list and the shell code blocks in SKILL.md.
Links to these hosts (documentation or services it may open):
kotlinlang.orgdeveloper.android.commedium.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Testing Coroutines With Runtest loads about 5.1k tokens when it runs. Until then it costs about 204 tokens; SKILL.md has 1,270 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from skydoves/android-testing-skills at commit 8665ed5, republished under its Apache-2.0 licence (© skydoves). 1,270 words, ~5,142 tokens.
.claude/skills/testing-coroutines-with-runtest/SKILL.md (or your agent's skills folder).runTest is the only correct entry point for testing suspend functions and viewModelScope-backed code on the JVM. This skill nails down the TestScope contract, the two TestDispatcher flavors, the shared TestCoroutineScheduler virtual clock, and the MainDispatcherRule plumbing that keeps Dispatchers.setMain from leaking between tests. Flow-specific assertions live in ../testing-flows-with-turbine/SKILL.md.
suspend fun or launches into viewModelScope / lifecycleScope.runBlocking { … } and the test hangs, or a 10-minute delay makes the test slow.Loading -> Success from a coroutine and the test needs to assert each intermediate state.runBlockingTest is deprecated. Use runTest or runTest(... dispatchTimeoutMs = ...) errors.IllegalStateException: Module with the Main dispatcher is missing because viewModelScope routed work through Dispatchers.Main.advanceTimeBy(5.seconds), advanceUntilIdle()) to trigger a timeout / retry / debounce.Flow emissions across time. Use ../testing-flows-with-turbine/SKILL.md (Turbine handles cancellation, hot vs cold, awaitItem/awaitComplete).MainTestClock rather than kotlinx.coroutines.test. Use ../../../compose/synchronization/controlling-the-test-clock/SKILL.md.../../runner/configuring-junit4-on-android/SKILL.md.testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.10.x") (docs/CORPUS.md §G.1). MUST be testImplementation only — never implementation. The library installs Dispatchers.setMain plumbing that is unsafe to ship to production.@file:OptIn(ExperimentalCoroutinesApi::class) (or per-call) on test files. currentTime, advanceTimeBy, advanceUntilIdle, runCurrent, and the dispatcher constructors are still @ExperimentalCoroutinesApi on 1.10.x (R5).CoroutineDispatcher (a "DispatcherProvider") so the SUT can route work onto the same TestCoroutineScheduler the test body advances. Hard-coded Dispatchers.IO / Dispatchers.Default will NOT see virtual time.fun foo() = runTest { … } so the platform TestResult is returned (R5; see "TestResult contract" below).public fun runTest(
context: CoroutineContext = EmptyCoroutineContext,
timeout: Duration = 60.seconds,
testBody: suspend TestScope.() -> Unit
): TestResult(docs/CORPUS.md §G.4.) Three things to internalize:
timeout is the whole-test deadline, NOT a per-dispatch quiescence timeout. The deprecated dispatchTimeoutMs overload had different semantics — see migration below.testBody returns, runTest waits for every child coroutine launched on TestScope to complete. Children launched on TestScope.backgroundScope are auto-cancelled at end of test instead. Use backgroundScope for hot-flow collectors.sealed interface TestScope : CoroutineScope {
val testScheduler: TestCoroutineScheduler // shared virtual clock
val backgroundScope: CoroutineScope // children auto-cancelled at test end
val currentTime: Long // virtual ms elapsed
val testTimeSource: TimeSource.WithComparableMarks
}Plus library extensions on TestScope: advanceTimeBy(delay), advanceTimeBy(durationMillis), advanceUntilIdle(), runCurrent(). (R5.)
| Dispatcher | Behavior | Pick when |
|---|---|---|
StandardTestDispatcher | Queues continuations on the scheduler. Nothing runs until runCurrent()/advanceTimeBy(...)/advanceUntilIdle(). Default for runTest. | Asserting intermediate states (Loading -> Success); precise virtual-time control; race-free repro. |
UnconfinedTestDispatcher | Eager: a launch { } runs synchronously up to its first real suspension. | Hot StateFlow/SharedFlow collector setup so the first emission is observed without explicit runCurrent(). |
(docs/CORPUS.md §G.5.)
Default to StandardTestDispatcher. Reach for UnconfinedTestDispatcher only when collector eagerness genuinely matters and you can defend why; it hides ordering bugs that production code under Dispatchers.Default would lose.
TestCoroutineScheduler is the single source of virtual time shared by every TestDispatcher participating in a test.
| API | Effect |
|---|---|
runCurrent() | Drains tasks already due at currentTime. Does NOT advance the clock. |
advanceTimeBy(delta) | Advances currentTime by delta, runs every task whose deadline is reached. |
advanceUntilIdle() | Loops runCurrent + advance until the queue is empty. "Run everything to completion." |
currentTime | Read-only virtual milliseconds elapsed. |
(R5.)
CRITICAL: Dispatchers.IO, Dispatchers.Default, and any newSingleThreadContext(...) are real thread pools and do NOT participate in the virtual clock. delay() inside withContext(Dispatchers.IO) uses real wall-clock time. The fix is dependency injection — pass a CoroutineDispatcher and substitute mainRule.dispatcher (or StandardTestDispatcher(testScheduler)) in tests.
Android's Dispatchers.Main is a HandlerContext over the main Looper that does not exist on a JVM unit test. Anything launched via viewModelScope, lifecycleScope, or flowOn(Dispatchers.Main) will throw IllegalStateException: Module with the Main dispatcher is missing without Dispatchers.setMain.
Verbatim from androidx/testutils/testutils-ktx/src/jvmMain/kotlin/androidx/testutils/MainDispatcherRule.jvm.kt (docs/CORPUS.md §G.3):
class MainDispatcherRule(
private val dispatcher: CoroutineDispatcher,
) : TestRule {
@OptIn(ExperimentalCoroutinesApi::class)
override fun apply(base: Statement?, description: Description?) =
object : Statement() {
override fun evaluate() {
Dispatchers.setMain(dispatcher)
try { base!!.evaluate() } finally { Dispatchers.resetMain() }
}
}
}@ExperimentalCoroutinesApi
class MainCoroutineRule(
val dispatcher: TestDispatcher = StandardTestDispatcher(),
) : TestWatcher() {
override fun starting(description: Description?) {
super.starting(description); Dispatchers.setMain(dispatcher)
}
override fun finished(description: Description?) {
super.finished(description); Dispatchers.resetMain()
}
}@OptIn(ExperimentalCoroutinesApi::class)
class MyVmTest {
@get:Rule val mainRule = MainCoroutineRule()
@Test fun loadsItems() = runTest(mainRule.dispatcher) {
val vm = MyViewModel(repo, mainRule.dispatcher)
vm.load()
runCurrent() // see Loading state
assertEquals(Loading, vm.state.value)
advanceUntilIdle() // run network/db
assertEquals(Success(items), vm.state.value)
}
}public expect class TestResult| Platform | Actual | Caller obligation |
|---|---|---|
| JVM | Unit | Anything works. |
| Native | Unit | Same. |
| Kotlin/JS, wasm | Promise<Unit> | Test function MUST return runTest { … }. |
(R5.)
For Android-only projects, you can write @Test fun foo() { runTest { … } } because TestResult collapses to Unit. For a KMP module, that swallows the Promise<Unit> and the JS framework cannot await the test — write @Test fun foo() = runTest { … } (single-expression form) every time. PREFERRED: always use the single-expression form to avoid surprises if the module ever ships KMP targets.
| 1.5.x and older | 1.7+ |
|---|---|
runBlockingTest { … } | runTest { … } |
TestCoroutineScope | TestScope |
TestCoroutineDispatcher | StandardTestDispatcher / UnconfinedTestDispatcher |
pauseDispatcher { } / resumeDispatcher | gone — explicit runCurrent / advanceTimeBy |
cleanupTestCoroutines() | unnecessary — runTest handles cleanup |
runTest(... dispatchTimeoutMs = X) { … } | runTest(... timeout = X.milliseconds) { … } (semantics changed) |
runBlockingTest is deprecated with WARNING; the dispatchTimeoutMs overload is deprecated with ERROR (R5; docs/CORPUS.md §G.2). The migration replacement is mechanical, but the timeout semantics are not identical: old dispatchTimeoutMs was per-dispatch quiescence, new timeout is the whole-test deadline.
runBlocking to test a suspend function// WRONG
@Test fun loadsItems() = runBlocking {
val vm = MyViewModel(repo)
vm.load()
Thread.sleep(2_000) // wait for the launch
assertEquals(Success(items), vm.state.value)
}
// WRONG because: runBlocking has no virtual time and no exception aggregation. The
// delay in load() runs in real time; the launch may not have completed; uncaught
// exceptions in children are silently swallowed.// RIGHT
@Test fun loadsItems() = runTest(mainRule.dispatcher) {
val vm = MyViewModel(repo, mainRule.dispatcher)
vm.load()
advanceUntilIdle() // virtual time flushes everything
assertEquals(Success(items), vm.state.value)
}// WRONG
@Test fun loadsItems() = runTest(mainRule.dispatcher) {
val vm = MyViewModel(repo, mainRule.dispatcher)
vm.load()
assertEquals(emptyList(), vm.state.value.items) // "passes" trivially
}
// WRONG because: with StandardTestDispatcher (the default), nothing runs until you
// advance. The launch inside vm.load() is queued but has not executed. The test
// passes for the wrong reason — the items list is empty because load() never ran.// RIGHT
@Test fun loadsItems() = runTest(mainRule.dispatcher) {
val vm = MyViewModel(repo, mainRule.dispatcher)
vm.load()
advanceUntilIdle()
assertEquals(items, vm.state.value.items)
}// WRONG: production code
class Repo {
suspend fun fetch() = withContext(Dispatchers.IO) {
delay(2_000) // real wall-clock time
api.fetch()
}
}
// WRONG because: Dispatchers.IO is a real thread pool. delay(2_000) takes 2 seconds
// of real time. advanceTimeBy(2_000) does NOT skip it. The whole test runs in real
// time and may exceed the 60s runTest timeout.// RIGHT: production code
class Repo(private val ioDispatcher: CoroutineDispatcher = Dispatchers.IO) {
suspend fun fetch() = withContext(ioDispatcher) {
delay(2_000)
api.fetch()
}
}
// RIGHT: test
@Test fun fetchesAfterTwoSeconds() = runTest(mainRule.dispatcher) {
val repo = Repo(ioDispatcher = mainRule.dispatcher) // shares scheduler
val deferred = async { repo.fetch() }
advanceTimeBy(2_001) // virtual; instant in real time
assertEquals(expected, deferred.await())
}// WRONG
@Test fun observes() = runTest {
val seen = mutableListOf<Int>()
vm.uiState.collect { seen += it } // never returns
assertEquals(listOf(0, 1), seen) // unreachable
}
// WRONG because: vm.uiState is a hot StateFlow. collect on the test's TestScope
// never completes; runTest waits for child completion and hangs until the 60s
// timeout fires. Use backgroundScope (auto-cancelled at end of test) — or Turbine.// RIGHT — backgroundScope
@Test fun observes() = runTest(mainRule.dispatcher) {
val seen = mutableListOf<Int>()
vm.uiState
.onEach { seen += it }
.launchIn(backgroundScope)
advanceUntilIdle()
vm.refresh()
advanceUntilIdle()
assertEquals(listOf(0, 1), seen)
}For Flow assertions specifically, prefer Turbine — see ../testing-flows-with-turbine/SKILL.md.
// WRONG
@get:Rule val mainRule = MainCoroutineRule() // scheduler A
@Test fun broken() = runTest { // scheduler B (auto-created)
val vm = MyViewModel(repo, mainRule.dispatcher) // posts to A
vm.load()
advanceUntilIdle() // flushes B only — A's work pending
assertEquals(Success(items), vm.state.value) // FAIL: still Loading
}
// WRONG because: by default runTest creates its own StandardTestDispatcher with a
// fresh TestCoroutineScheduler. mainRule's dispatcher has a different scheduler;
// advanceUntilIdle() only flushes the test body's scheduler. (Recent kotlinx-
// coroutines-test versions do try to reuse Main's scheduler when Main was replaced
// with a TestDispatcher BEFORE runTest starts, but the defensive contract — pass
// the dispatcher explicitly — never breaks across versions.)// RIGHT — share the scheduler explicitly
@Test fun ok() = runTest(mainRule.dispatcher) {
val vm = MyViewModel(repo, mainRule.dispatcher)
vm.load()
advanceUntilIdle()
assertEquals(Success(items), vm.state.value)
}(R5 gotcha #4.)
runTest { … }, not runBlocking { … } or the deprecated runBlockingTest { … }.kotlinx-coroutines-test from testImplementation only. MUST NOT put it on implementation.@file:OptIn(ExperimentalCoroutinesApi::class) (or per-call) before using currentTime, advanceTimeBy, advanceUntilIdle, runCurrent, StandardTestDispatcher(...), or UnconfinedTestDispatcher(...).Dispatchers.setMain(testDispatcher) (via MainDispatcherRule/MainCoroutineRule) for any ViewModel/viewModelScope test. Reset in the rule's finally / @After.mainRule.dispatcher into runTest(...) so the TestScope and Main share a single scheduler. Otherwise advanceUntilIdle() only flushes one of them.CoroutineDispatcher your production code uses for IO/Default work. Hard-coded Dispatchers.IO will run in real time even under runTest.TestScope.backgroundScope (or use Turbine). Never collect directly on the TestScope — the test hangs to the 60 s timeout.advanceUntilIdle() (or runCurrent() for the "right now" microtask queue). With StandardTestDispatcher, queued work has not run yet.runTest(... dispatchTimeoutMs = X) — deprecated with error. Use timeout = X.milliseconds; remember the semantics changed (whole-test deadline, not per-dispatch quiescence).@Test fun foo() = runTest { … } for KMP correctness on JS/wasm where TestResult is Promise<Unit>.StandardTestDispatcher. Use UnconfinedTestDispatcher only for hot-flow collector setup where eagerness is the point.kotlinx-coroutines-debug on the test classpath so runTest timeouts include a coroutine stack dump../gradlew :module:test passes with no Module with the Main dispatcher is missing exception.runBlocking { … } or runBlockingTest { … } calls remain in test sources (grep -rn 'runBlocking[^T]' src/test; grep -rn 'runBlockingTest' src/test).dispatchTimeoutMs parameter remains (grep -rn 'dispatchTimeoutMs' src/test).viewModelScope test class declares a @get:Rule MainCoroutineRule (or equivalent) and passes its dispatcher into runTest(...).backgroundScope or flow.test { … } (Turbine), never bare collect on TestScope.Dispatchers.IO / Dispatchers.Default accept an injectable CoroutineDispatcher and the test substitutes mainRule.dispatcher.@file:OptIn(ExperimentalCoroutinesApi::class) is on every test file using advanceTimeBy / advanceUntilIdle / runCurrent / currentTime.fun foo() = runTest { … } single-expression form.androidx/testutils/testutils-ktx/src/jvmMain/kotlin/androidx/testutils/MainDispatcherRule.jvm.kt — canonical MainDispatcherRule (docs/CORPUS.md §G.3).androidx/pdf/.../MainCoroutineRule.kt — TestWatcher flavor that exposes the dispatcher.androidx/navigationevent/...NavigationEventDispatcherTest.kt — runTest(UnconfinedTestDispatcher()) + launchIn(backgroundScope) pattern.androidx/room3/.../InvalidationTrackerTest.kt — injecting TestScope().coroutineContext into the SUT.../testing-flows-with-turbine/SKILL.md — Flow assertions, awaitItem/awaitComplete, hot vs cold cancellation.../../mocking/mocking-with-mockito/SKILL.md — mocking suspend functions with mockito-kotlin.../../mocking/mocking-with-mockk/SKILL.md — coEvery/coVerify for suspend.../../runner/configuring-junit4-on-android/SKILL.md — JUnit4 plumbing surrounding runTest.../../robolectric/using-robolectric-correctly/SKILL.md — when the SUT needs Android framework on the JVM.../../../fundamentals/strategies/applying-testing-strategies/SKILL.md — small/medium/big test sizing.../../../fundamentals/strategies/organizing-test-source-sets/SKILL.md — where coroutine tests belong.../../../compose/synchronization/controlling-the-test-clock/SKILL.md — Compose's MainTestClock (separate from TestCoroutineScheduler).../../../instrumentation/runner/running-instrumented-tests-with-androidjunit4/SKILL.md — when the same SUT runs on a device.tasks/research/R5-coroutines-test-turbine.md.© skydoves, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in jvm-tests/coroutines/testing-coroutines-with-runtest of skydoves/android-testing-skills.
Open the folder on GitHubat commit 8665ed5
Testing Coroutines With Runtest next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Testing Coroutines With Runtest this skillskydoves/android-testing-skills | 334 | — | ~5.1k | Automated safety check: Pass | Apache-2.0 | |
| Compose Multiplatform Patternsmonta-app/ocpp-emulator | 180 | 5 repos | ~2k | Automated safety check: Pass | Apache-2.0 | |
| Kotlin Patternsgetknit/knit | 133 | 5 repos | ~4.7k | Automated safety check: Pass | GPL-3.0 | |
| Summoncodeyousef/summon | 167 | — | ~1.1k | Automated safety check: Pass | Apache-2.0 | |
| Add JSON Schemayontrack/yontrack | 102 | — | ~883 | Automated safety check: Pass | MIT | |
| Add Ktnip Parameter Strategyvendelieu/telegram-bot | 249 | — | ~613 | Automated safety check: Pass | Apache-2.0 |
monta-app/ocpp-emulator
Compose Multiplatform and Jetpack Compose patterns for KMP projects — state management, navigation, theming, performance, and platform-specific UI.
getknit/knit
Idiomatic Kotlin patterns, best practices, and conventions for building robust, efficient, and maintainable Kotlin applications with coroutines, null safety, and DSL builders.
codeyousef/summon
A skill your agent uses when developing applications with the Summon Kotlin Multiplatform UI framework.
yontrack/yontrack
Add a new downloadable JSON schema to the Resources page — Kotlin provider class only, auto-discovered by Spring.
vendelieu/telegram-bot
Adds a new parameter resolution strategy to the ktnip KSP processor.
cometchat/cometchat-skills
Builds chat on Android with your own UI against the headless CometChat Chat SDK v5, covering install, Jetifier conflicts, credentials and init-before-login ordering.
skydoves/android-testing-skills
A skill your agent uses to verify Compose layout measurements from a UI test using assertWidthIsEqualTo, assertHeightIsEqualTo, assertWidthIsAtLeast, assertHeightIsAtLeast…
skydoves/android-testing-skills
A skill your agent uses to verify a Compose semantics node's properties from a UI test using assertExists, assertDoesNotExist, assertIsDisplayed, assertIsNotDisplayed, assertIsDeactivated…
skydoves/android-testing-skills
A skill your agent uses to render every Jetpack Compose @Preview as a screenshot on a real Android device or emulator and publish a browsable HTML catalog from CI.
skydoves/android-testing-skills
A skill your agent uses to capture visual artefacts from a device for test failures, golden image generation, QA repro, and demo videos.
skydoves/android-testing-skills
A skill your agent uses to pick the correct Compose UI test entry point.
skydoves/android-testing-skills
A skill your agent uses to pick which behaviors to cover in an Android test suite using Google's five-category state vocabulary plus the explicit "what NOT to test" list from…
Works with
Categories
A skill your agent uses to test suspend functions and coroutine-using classes on the JVM with kotlinx-coroutines-test. Testing Coroutines With Runtest is an agent skill from skydoves/android-testing-skills. Use this skill to test suspend functions and coroutine-using classes on the JVM with kotlinx-coroutines-test.
Testing Coroutines With Runtest fits situations like: test suspend functions and coroutine-using classes on the JVM with kotlinx-coroutines-test.
Run `npx skills add skydoves/android-testing-skills --skill testing-coroutines-with-runtest -a claude-code`. Or copy the skill folder (jvm-tests/coroutines/testing-coroutines-with-runtest in skydoves/android-testing-skills) into .claude/skills/testing-coroutines-with-runtest in your project. Claude Code loads it when a task matches its description.
Run `npx skills add skydoves/android-testing-skills --skill testing-coroutines-with-runtest -a codex`. Or copy the skill folder (jvm-tests/coroutines/testing-coroutines-with-runtest in skydoves/android-testing-skills) into .agents/skills/testing-coroutines-with-runtest in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add skydoves/android-testing-skills --skill testing-coroutines-with-runtest -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/testing-coroutines-with-runtest, .gemini/skills/testing-coroutines-with-runtest, .github/skills/testing-coroutines-with-runtest and .opencode/skills/testing-coroutines-with-runtest in your project.
SKILL.md names no scripts, command-line tools or credentials: Testing Coroutines With Runtest is instructions for the agent only.
SKILL.md names 3 domains. As links in the text: kotlinlang.org, developer.android.com and medium.com. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Testing Coroutines With Runtest is published under the Apache-2.0 licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.
About 5.1k tokens (SKILL.md is roughly 21k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Testing Coroutines With Runtest: Compose Multiplatform Patterns (monta-app/ocpp-emulator, 180 stars), Kotlin Patterns (getknit/knit, 133 stars), Summon (codeyousef/summon, 167 stars) and Add JSON Schema (yontrack/yontrack, 102 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
skydoves (a GitHub user) maintains it in skydoves/android-testing-skills, which has 334 GitHub stars. The repository holds 50 skills in this directory. The repository was last updated on May 25, 2026.
Source: skydoves/android-testing-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.