mockk/mockk

mocking library for Kotlin

View on GitHub ↗Jump to charts ↓Open shareable report →

Data as of . Signed-in members get hourly updates — create a free account.

Summary Information

Updated 1 hour ago
Added to GitGenius on September 11th, 2026
Created on October 17th, 2017
Open Issues & Pull Requests: 296 (+1)
GitHub issues: Enabled
Number of forks: 420
Total Stargazers: 5,763 (+0)
Total Subscribers: 56 (+0)

Repository Insights (GitGenius)

Median issue/PR response: 14.9 days
Mean response time: 108.8 days
90th percentile: 317.5 days
Tracked items: 332

How this project is maintained

About 11% of issues opened in the past year have never received a reply. 100% of open issues come from outside the core team, so the backlog reflects real-world use rather than internal planning. Work labelled "android" is answered fastest, typically in about 4 days, while "good-first-issue" waits about 9 weeks. 64% of issues opened in the past year have been closed, leaving a working backlog. Three people close 80% of everything that gets resolved.

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 216
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 1,131 days
Stale 30+ days: 211
Stale 90+ days: 207

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 1
Events in 7 days: 1

Top labels

  • bug (201)
  • important (54)
  • enhancement (40)
  • Kotlin bug (39)
  • java (37)
  • android (29)
  • coroutines (26)
  • stale (18)

Most active issues this week

Sign in to see which issues are moving.
Sign in

Detailed Description

MockK is a mocking library for Kotlin that provides a DSL-based approach to creating and verifying mock objects in unit tests.

The library addresses the need for Kotlin-native mocking by offering a fluent, type-safe syntax tailored to Kotlin's language features. It works by allowing developers to define mock behavior using expressions like `every { ... }` for stubbing and `verify { ... }` for assertion, with support for both standard and coroutine-based mocking through `coEvery` and `coVerify`. The tool enforces strict mocking by default, requiring explicit behavior specification before use. For teams practicing Behavior-Driven Development, MockK provides BDD-style aliases that map standard operations to more readable names like `given`, `coGiven`, `then`, and `coThen`.

Developers should choose MockK if they are building Kotlin applications and want a mocking solution designed specifically for the language rather than adapting Java-focused tools. The library supports multiple deployment contexts including JVM unit tests, Android unit tests, and instrumented Android tests through separate artifact variants. It integrates with Spring Boot and Quarkus through dedicated support libraries. Developers should be aware of known limitations: inline functions cannot be mocked, PowerMock requires workarounds to run alongside MockK, and certain JDK versions introduce warnings or access exceptions when using spies and static mocking.

The project maintains a substantial base of real-world adopters, as evidenced by the fact that nearly all open issues originate from outside users rather than the core team. However, responses to issues and pull requests frequently take weeks or longer. Work in the issue tracker centers on bug fixes, important issues, and enhancement requests.