MockK logo

MockK

Mocking library for Kotlin with first-class support for coroutines, object/static mocks and DSL designed around Kotlin idioms.

-

Our Verdict

Clearly the right mocking library for Kotlin, worth the migration from Mockito for Kotlin-heavy code.

Pros

  • Designed around Kotlin idioms from day one
  • First-class coroutine and suspend function mocking
  • Handles object and top-level function mocks
  • Readable DSL versus Mockito-Kotlin glue

Cons

  • Slower than Mockito on very large suites
  • Mistakes produce cryptic stack traces
  • Less Stack Overflow coverage than Mockito
  • Mocking everything hides Kotlin design smells
Best for: Kotlin teams testing coroutines, sealed classes and objects Not for: Mixed Java/Kotlin codebases where Mockito is already well embedded

When to Use MockK

Good fit if you need

  • Kotlin-idiomatic mocking with coroutine test support
  • Object and companion object mocking for Kotlin code
  • Verify DSL with natural Kotlin syntax for call assertions
  • Mock suspend functions in Kotlin coroutine test suites

Lock-in Assessment

High 5/5
Lock-in Score
5/5

MockK Pricing

Pricing Model
free
Free Tier
Yes
Entry Price
Enterprise Available
No
Transparency Score

Beta — estimates may differ from actual pricing

1,000
1001K10K100K1M

Estimated Monthly Cost

$25

Estimated Annual Cost

$300

Estimates are approximate and may not reflect current pricing. Always check the official pricing page.

Project Health

A

Health Score

5.7k 405
Bus Factor

10

Last Commit

1 day

Release Freq

54d

Open Issues

308

Issue Response

1d

License

Apache-2.0

Last checked: 2026-04-21

Community Discussion

Comments powered by Giscus (GitHub Discussions). You need a GitHub account to comment.