
MockK
The facts below are what the maker publishes about MockK, checked and dated. Our editors have not written about it yet.
The facts
Each one read from MockK's own pages, with the date it was checked.
What it does
- BDD
- Optional BDD-style aliases include given, then, coGiven, and coThen.checked 4 Oct 2026
- BDD aliases
- MockK provides optional BDD style aliases such as given and then.checked 11 Oct 2026
- Coroutines
- MockK supports stubbing and verifying suspend functions with coroutine-specific APIs, with the kotlinx-coroutines-core dependency.checked 11 Oct 2026
- Distribution
- The setup guide lists JVM, Android unit-test and Android instrumented-test dependency artifacts.checked 11 Oct 2026
- Framework integrations
- The site points to SpringMockK for Spring support and quarkus-mockk for mocking Quarkus beans.checked 11 Oct 2026
- Framework support
- The site links to SpringMockK and Quarkus-MockK support.checked 4 Oct 2026
- JDK caveats
- The documentation notes dynamic Java agent warnings on JDK 21+ and says spies or mockkStatic may not work on JDK 16+.checked 11 Oct 2026
- Known issue
- The site notes that spies and mockkStatic may fail on JDK 16 and later with access exceptions.checked 4 Oct 2026
- Known limitation
- Inline functions cannot be mocked, according to the known issues section.checked 11 Oct 2026
- Kotlin compatibility
- The site says MockK supports Kotlin 1.4 and higher from version 1.13.0.checked 4 Oct 2026
- Kotlin support
- The site says MockK supports Kotlin 1.4 and higher from MockK version 1.13.0.checked 11 Oct 2026
- License
- The linked public GitHub repository identifies its license as Apache-2.0.checked 4 Oct 2026
- Mock behavior
- Mocks are strict by default and require behavior to be provided.checked 4 Oct 2026
- Mocking features
- The feature guide covers spies, relaxed and partial mocks, object, class, enum and constructor mocks, argument matching, and call verification.checked 11 Oct 2026
- Purpose
- MockK is a mocking library for Kotlin.checked 11 Oct 2026
- Security-related feature
- Restricted Mocking can prevent mocking classes considered problematic for reliable tests, and the documentation lists several Java system and collection classes restricted by default.checked 4 Oct 2026
- Setup
- The documentation shows adding MockK as a test dependency with Gradle or Maven.checked 11 Oct 2026
- Strict mocks
- Mocks are strict by default, so users need to provide behavior for them.checked 11 Oct 2026
- Support
- The project directs users to Stack Overflow or Gitter for questions and GitHub for bug reports.checked 11 Oct 2026
- Suspending spy caveat
- The site warns that using a spy with a suspending function can produce unexpected test results.checked 11 Oct 2026
- Test integrations
- The documentation describes JUnit 4 and JUnit 5 support, including a JUnit 5 extension for initializing mocks.checked 11 Oct 2026




