Kotest
Powerful, elegant and flexible test framework for Kotlin with assertions, property testing and data driven tests. (by kotest)
mockito-kotlin
Using Mockito with Kotlin (by nhaarman)
Kotest | mockito-kotlin | |
---|---|---|
17 | 6 | |
4,461 | 3,115 | |
0.5% | 0.2% | |
9.7 | 5.9 | |
10 days ago | 2 months ago | |
Kotlin | Kotlin | |
Apache License 2.0 | MIT License |
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.
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.
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
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
Kotlin testing with Kotest and MockK
-
Best practices for Unit Testing Android Apps with Mockk, Kotest and others
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?
-
Kotlin Mutation Tests
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
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?
-
Testing with fakes different states?
We're using Kotest for our unit tests and are quite happy with it.
-
Testing with Kotlin and JUnit5
Basic testing in Kotlin with Kotest built for kotlin specificatlly (upcoming)
-
Kotlin&Junit vs Groovy&Spock
Here you are: https://github.com/kotest/kotest/issues/189
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
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
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
What's wrong with Mockito for Kotlin?
-
From Java to Kotlin. There and back again
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
- Argument(s) are different! Wanted: Unit test
What are some alternatives?
When comparing Kotest and mockito-kotlin you can also consider the following projects:
spek - A specification framework for Kotlin
mockk - mocking library 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.
Kluent - Fluent Assertion-Library for Kotlin
balin - Balin is an automation library for Kotlin. It's basically a Selenium-WebDriver wrapper inspired by Geb.
strikt - An assertion library for Kotlin
hamkrest - Hamcrest for Kotlin
mock-fuel - JUnit 5 extension to easily test with the http client Fuel for Kotlin
atrium - A multiplatform expectation library for Kotlin