OSS TanbouSign in with GitHub

assert kotlinx.coroutines Flow items, completion, and errors in event order

About these scores

OSS scale score is an unbounded metric that log-compresses and weights Stars, Watchers, Forks, and Contributors. Discovery score is the current OSS scale score minus the score at discovery. Update pace is commits in the last 30 days, growth momentum is the OSS scale score difference within the recent observation window, and OSS health is a 0–100 rating based on available recency, Community Health, and release data.

Stars
2,863
Primary language
Kotlin
License
Apache-2.0
Repository last updated
Sep 25, 2026
On this page

Overview

Turbine is a small testing library for kotlinx.coroutines Flow. It connects a Flow to a test Turbine so items, completion, and failures can be awaited and asserted in event order.

Features and best fit

Based on official documentation; not hands-on tested · Content checked:

Key features

Assert Flow events with await-style APIs

Inside Flow.test, awaitItem(), awaitComplete(), and awaitError() turn asynchronous Flow events into an explicit assertion sequence.

Sources: [2]

Use testIn when scenarios need multiple Turbines

testIn creates Turbines within a CoroutineScope so multiple streams can be awaited independently in the same test scenario.

Sources: [2]

Best fit

Fits unit tests for Kotlin code that exposes StateFlow or Flow

Android ViewModels, repositories, and other coroutine-based components can verify state and event sequences without hand-written collection and synchronization logic.

Sources: [2]

Before adoption

Recheck behavior when kotlinx.coroutines test changes

The README states that Turbine has a stable API but currently depends on the unstable UnconfinedTestDispatcher API from kotlinx.coroutines test. Coroutine-library upgrades therefore deserve timing and runTest regression checks.

Sources: [2][3]

Official sources

  1. [1]cashapp/turbine — GitHub repository(2026-10-06)
  2. [2]Turbine 1.2.1 — README(2026-10-06)
  3. [3]Turbine 1.2.1 release(2026-10-06)
  4. [4]Turbine Apache-2.0 license(2026-10-06)
Supplemental curator note

Turbine turns Flow collection tests into a readable event-awaiting DSL instead of manual collection and synchronization. Recheck behavior when upgrading kotlinx.coroutines because Turbine currently depends on an unstable API from its test artifact.

Try it in 3 steps

  1. 1

    Add Turbine 1.2.1 as a test dependency

    Add the reviewed stable 1.2.1 artifact from Maven Central to test dependencies.

    testImplementation("app.cash.turbine:turbine:1.2.1")
  2. 2

    Assert Flow items and completion in order

    Use the minimal README example to await two Flow items and normal completion in sequence.

    flowOf("one", "two").test { assertEquals("one", awaitItem()) assertEquals("two", awaitItem()) awaitComplete() }
  3. 3

    Run the unit tests

    Run the project JVM unit tests and confirm the Turbine Flow test passes.

    ./gradlew test
Check the official README

Growth

Growth trends · Last 30 days

2,863 Stars

Trend data is still being collected.

Development activity

Last 90 days · weekly

Commits (last 30 days)
5
Open PRs
6

Development activity is still being collected.

Built with

Categories and tags

GitHub data

GitHub dataView detailed GitHub data
Stars
2,863
Forks
137
Watchers
21
Open issues
12
Contributors
34
Owner type
Organization
Primary language
Kotlin
License
Apache-2.0
Repository last updated
Sep 25, 2026
Write a related article

Share a guide or use case for this OSS in Markdown. Articles are published after administrator approval.

Report incorrect information

Tell us if any listing information is incorrect or outdated.

After reading this page, do you know what to do next?