kp-testing-coroutines

Installation
SKILL.md

One-line summary

Use runTest { … } + a TestDispatcher for fast, deterministic tests of coroutine code — virtual time replaces real delay, and dispatcher injection makes your production code testable without runBlocking.

When to use this skill

  • Writing unit tests for suspend fun or Flow.
  • Testing time-dependent behavior (timeouts, delays, debounce, sample) without real waiting.
  • Testing concurrent coroutines and their interactions.
  • Replacing slow / flaky runBlocking test setups.

When NOT to use this skill

  • The code isn't actually suspending and no coroutines are involved — use a regular test.
  • Integration tests that genuinely need real time and threads — runBlocking may still be appropriate (rarely).

Core content

runTest { … } is the canonical entry point from kotlinx-coroutines-test. It runs your test body as a coroutine with a TestScope that has a TestDispatcher and a virtual clock.

Installs
1
GitHub Stars
1
First Seen
Jul 13, 2026
kp-testing-coroutines — yonatankarp/software-design-skills