Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lupuuss/Mokkery
The mocking library for Kotlin Multiplatform, easy to use, boilerplate-free and compiler plugin driven.
https://github.com/lupuuss/Mokkery
ir k2 kmp kotlin kotlin-compiler-plugin kotlin-multiplatform kotlin-multiplatform-mobile mock test
Last synced: about 1 month ago
JSON representation
The mocking library for Kotlin Multiplatform, easy to use, boilerplate-free and compiler plugin driven.
- Host: GitHub
- URL: https://github.com/lupuuss/Mokkery
- Owner: lupuuss
- License: apache-2.0
- Created: 2023-06-12T19:45:23.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2024-10-30T00:44:34.000Z (about 1 month ago)
- Last Synced: 2024-10-30T02:51:01.086Z (about 1 month ago)
- Topics: ir, k2, kmp, kotlin, kotlin-compiler-plugin, kotlin-multiplatform, kotlin-multiplatform-mobile, mock, test
- Language: Kotlin
- Homepage: https://mokkery.dev
- Size: 3.37 MB
- Stars: 188
- Watchers: 4
- Forks: 8
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- kmp-awesome - Mokkery - Mocking library (Libraries / 🩺 Test)
README
[![Gradle Plugin Portal Stable](https://img.shields.io/gradle-plugin-portal/v/dev.mokkery)](https://plugins.gradle.org/plugin/dev.mokkery)
[![Kotlin](https://img.shields.io/badge/kotlin-2.0.21-blue.svg?logo=kotlin)](http://kotlinlang.org)
[![GitHub](https://img.shields.io/github/license/lupuuss/Mokkery)](https://github.com/lupuuss/Mokkery/blob/main/LICENSE)
[![Docs](https://img.shields.io/static/v1?label=api&message=reference&labelColor=gray&color=blueviolet&logo=gitbook&logoColor=white)](https://mokkery.dev/api_reference)The mocking library for Kotlin Multiplatform, easy to use, boilerplate-free and compiler plugin driven.
```kotlin
class BookServiceTest {val repository = mock {
everySuspend { findById(any()) } calls { (id: String) -> Book(id) }
}
val service = BookService(repository)@Test
fun `rent should call repository for each book`() = runTest {
service.rentAll(listOf("1", "2"))
verifySuspend(exhaustiveOrder) {
repository.findById("1")
repository.findById("2")
}
}
}
```As shown in the example above, this library is highly inspired by the [MockK](https://mockk.io).
If you have any experience with MockK, it should be easy to start with Mokkery!### [Documentation is available here!](https://mokkery.dev/)