mockito-kotlin VS Kotest

Compare mockito-kotlin vs Kotest and see what are their differences.

Kotest

Powerful, elegant and flexible test framework for Kotlin with additional assertions, property testing and data driven testing (by kotest)
Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
mockito-kotlin Kotest
6 17
3,071 4,282
0.0% 1.5%
6.1 9.4
19 days ago 9 days ago
Kotlin Kotlin
MIT License Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

mockito-kotlin

Posts with mentions or reviews of mockito-kotlin. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-05-10.
  • Best practices for Unit Testing Android Apps with Mockk, Kotest and others
    5 projects | dev.to | 10 May 2023
    As you can see, I create mockUsersRepository object using mock( function. Then, in setup() method, I set up this repository in such a way so that it would return a list of hardcoded values. After this, on top of everything else, I check if, for mockUsersRepository object, getUsers method was called with verify function, in the test method. It’s important to note that Mockito is a very old framework and was originally written for Java. When Kotlin appeared, it turned out that out of the box this framework can work with some limitations, which is why an extension, mockito-kotlin, was released. The example above was written with it. Another Mockito’s limitation was that it was impossible to mock final classes and static methods, and all classes are final by default in Kotlin. Currently, this is solved through mockito-inline but, before, it was a serious limitation. In respect to Java development, there was and is an alternative for Android developers, PowerMock.
  • Why don't you write unit tests and integration tests to ksp project
    5 projects | dev.to | 11 Jan 2023
    In the demo project, I used junit and mockito. One thing we need to pre-learn do the unit test, that is ksp class diagram.
  • Spring with java vs Spring with kotlin
    4 projects | /r/Kotlin | 15 Sep 2022
    What's wrong with Mockito for Kotlin?
  • From Java to Kotlin. There and back again
    7 projects | dev.to | 1 Apr 2022
    Mockito does not work correctly with Kotlin types out of the box. Spring recommends using Mockk. There is also a special module for Mockito, which adds support for Kotlin - Mockito-Kotlin.
  • Avoiding Stringly-typed in Kotlin
    1 project | /r/Kotlin | 20 Feb 2022
  • Argument(s) are different! Wanted: Unit test
    1 project | /r/androiddev | 27 Dec 2020

Kotest

Posts with mentions or reviews of Kotest. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-11-29.
  • AocKt: Test-driven Advent of Code in Kotlin
    3 projects | /r/Kotlin | 29 Nov 2023
    As you might know, Advent of Code will begin this Friday! If, like me, you want to have a go at solving the puzzles in Kotlin, I would like to share with you a little library I've developed to reduce boilerplate and solve the puzzles in a test-driven approach. It is based on Kotest, a modern and Kotlin-first test framework.
  • Tests Everywhere - Kotlin
    4 projects | dev.to | 23 Nov 2023
    Kotlin testing with Kotest and MockK
  • Best practices for Unit Testing Android Apps with Mockk, Kotest and others
    5 projects | dev.to | 10 May 2023
    As a matter of fact, in the previous examples, we have shifted a bit away from the TDD standards in the meaning that we test not only the operability of our code, but rather check if the code runs according to certain specifications (Given/When/Then). These specifications are our tests, and the syntactic sugar in the form of the possibility to give clear names to the tests using DisplayName and the grouping of the tests by a set of similar attributes helps us clearly formulate these specifications. There is an entire family of frameworks in different languages that allow us to create such specifications: for Java it is Spock, for Ruby—RSpec, and for Kotlin—Spek and Kotest frameworks. Below, I will go into more detail about them.
  • Why do Kotlin tests (for Gradle projects) have to be inside classes?
    1 project | /r/Kotlin | 28 Jan 2023
  • Kotlin Mutation Tests
    1 project | /r/Kotlin | 25 Jan 2023
    I've tried so many times. SO MANY. I love the idea of mutation testing. Even chatGPT couldn't help me. It just made up fake mutation testing frameworks to try. To me, pitest is dead. kotest is not mutation testing, but it's property testing is the next best thing I have found to revolutionize your unit tests.
  • How to improve third-party libraries with Kotlin extensions
    2 projects | dev.to | 6 Dec 2022
    The extensions are not particularly useful in this scenario because the described functionality can be incorporated into the Host class. On the other hand, they flourish in test frameworks like Kotest and enable the rapid development of useful add-ons like custom matchers. Extending third-party libraries with utility functions is another prevalent use case. In the next sections, we'll zero in on this specific aspect.
  • Are there any plans to make a better build system for Kotlin than Gradle?
    4 projects | /r/Kotlin | 17 Sep 2022
  • Testing with fakes different states?
    1 project | /r/androiddev | 3 Aug 2022
    We're using Kotest for our unit tests and are quite happy with it.
  • Testing with Kotlin and JUnit5
    2 projects | dev.to | 10 Jun 2022
    Basic testing in Kotlin with Kotest built for kotlin specificatlly (upcoming)
  • Kotlin&Junit vs Groovy&Spock
    1 project | /r/Kotlin | 5 May 2022
    Here you are: https://github.com/kotest/kotest/issues/189

What are some alternatives?

When comparing mockito-kotlin and Kotest you can also consider the following projects:

mockk - mocking library for Kotlin

spek - A specification framework for Kotlin

kotlin-faker - Port of a popular ruby faker gem written in kotlin. Generate realistically looking fake data such as names, addresses, banking details, and many more, that can be used for testing and data anonymization purposes.

balin - Balin is an automation library for Kotlin. It's basically a Selenium-WebDriver wrapper inspired by Geb.

Kluent - Fluent Assertion-Library for Kotlin

strikt - An assertion library for Kotlin

mock-fuel - JUnit 5 extension to easily test with the http client Fuel for Kotlin

hamkrest - Hamcrest for Kotlin

atrium - A multiplatform expectation library for Kotlin