Turbine (Kotlin Flow Testing)

Testing library for Kotlin's Flow, SharedFlow, and StateFlow. Turbine makes asserting on reactive streams ergonomic — instead of manually collecting flows in tests, call flow.test { awaitItem(), awaitComplete(), awaitError() } in a suspend test block. Handles coroutine timing, cancellation, and event ordering. Eliminates the boilerplate of collecting flows with launch {} and tracking items in a list.

Evaluated Mar 06, 2026 (0d ago) v1.1+
Homepage ↗ Repo ↗ Developer Tools kotlin flow testing coroutines state reactive cash-app turbine
⚙ Agent Friendliness
67
/ 100
Can an agent use this?
🔒 Security
88
/ 100
Is it safe for agents?
⚡ Reliability
85
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
85
Error Messages
86
Auth Simplicity
95
Rate Limits
95

🔒 Security

TLS Enforcement
90
Auth Strength
88
Scope Granularity
85
Dep. Hygiene
88
Secret Handling
90

Test library — no direct security surface. No network or credential handling. Cash App maintains.

⚡ Reliability

Uptime/SLA
88
Version Stability
84
Breaking Changes
80
Error Recovery
88
AF Security Reliability

Best When

You're testing Kotlin Flow, StateFlow, or SharedFlow emissions and want readable, sequential assertions without manual coroutine boilerplate.

Avoid When

You need to test RxJava streams or non-Kotlin reactive frameworks — use framework-native test utilities instead.

Use Cases

  • Test Kotlin StateFlow and SharedFlow emissions from agent ViewModel logic without manual coroutine job management in tests
  • Assert the exact sequence of items emitted by agent data streams — awaitItem() blocks until the next emission for readable sequential assertions
  • Test flow completion and error scenarios in agent reactive pipelines — awaitComplete() and awaitError() make terminal event assertions concise
  • Use Turbine with multiple flows simultaneously (turbineScope) for testing agent state machines that coordinate multiple streams
  • Test agent repository flows that combine database updates with network responses in reactive patterns

Not For

  • Non-Kotlin reactive streams — Turbine targets Kotlin Flow only; use RxJava's TestObserver for RxJava testing
  • Flows that emit very high volumes of items — Turbine buffers items; high-frequency agent streams need custom collection strategies
  • Testing time-based flow operators in isolation — use kotlinx-coroutines-test TestCoroutineDispatcher for precise time control with delay-based flows

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

Test library — no authentication.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

Cash App open source library. Apache 2.0 license.

Agent Metadata

Pagination
none
Idempotent
Full
Retry Guidance
Not documented

Known Gotchas

  • Turbine requires kotlinx-coroutines-test for TestScope — using Turbine without TestCoroutineDispatcher causes timing issues in tests with delays
  • Unconsumed items cause test failure — if your flow emits 3 items but you only awaitItem() twice, Turbine fails with 'expected 0 unconsumed items'; use cancelAndConsumeRemainingEvents() to ignore
  • awaitItem() has a default timeout (1 second) — slow agent operations or flows waiting for data may timeout; configure timeout with .test(timeout = 5.seconds)
  • Turbine 1.x requires calling awaitComplete() or cancelAndIgnoreRemainingEvents() to end the test block cleanly — not calling either leaves the coroutine suspended
  • SharedFlow and StateFlow require special handling — SharedFlow with replay=0 may miss emissions before Turbine subscribes; use replay > 0 or synchronize emission timing
  • turbineScope { } for multiple flows runs flows concurrently — item ordering between different flows is non-deterministic and tests relying on cross-flow ordering are flaky

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for Turbine (Kotlin Flow Testing).

$99

Scores are editorial opinions as of 2026-03-06.

5215
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered