/kmock

A humble mocking library for Kotlin, KotlinJS and Kotlin Multiplatform using Kotlin Symbol Processing (KSP).

Primary LanguageKotlinApache License 2.0Apache-2.0

KMock

A humble mocking library for Kotlin, KotlinJS and Kotlin Multiplatform using Kotlin Symbol Processing (KSP).

Latest release License Platforms CI - Build Snapshot Version Coverage Quality Gate Status Reliability Rating CII Best Practices

About The Project

Writing mocks is certainly no witchcraft, but doing them by hand day for day can be dull. More importantly it takes time which can be better invested directly into writing tests. However, while JVM projects get indeed supreme support by either MockK or Mockito, Kotlin Multiplatform still has nothing comparable. KMock aims to fill that gap and will hopefully advance to there over time. Similar to other projects it uses KSP, but it is capable of associating generated Mocks correctly to their belonging shared source sets (like native, ios, etc) without additional setup and with minimal boilerplate done by consumers. KMock works currently only based on interfaces. It supports to some extent features like spying and relaxation of Mocks to make them non intrusive. So if the project caught your eye check out the Playground or dive into the Documentation.

Dependencies

KMock has the following dependencies:

Additional Requirements

  • Android 5.0 (API 21) to Android 13 (API 33)
  • Java 11

Changelog

See changelog.

Versioning

This project uses Semantic Versioning as a guideline for our versioning.

Contributing

You want to help or share a proposal? You have a specific problem? Read the following:

Releasing

Please take a look here.

Copyright and License

Copyright (c) 2024 Matthias Geisler / All rights reserved.

Please refer to the License for further details.