Kotest
Powerful, elegant and flexible test framework for Kotlin with additional assertions, property testing and data driven testing (by kotest)
turbine
A small testing library for kotlinx.coroutines Flow (by cashapp)
Kotest | turbine | |
---|---|---|
17 | 8 | |
4,289 | 2,324 | |
0.6% | 0.5% | |
9.4 | 8.2 | |
about 22 hours ago | 20 days ago | |
Kotlin | Kotlin | |
Apache License 2.0 | 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.
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
turbine
Posts with mentions or reviews of turbine.
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
Much of this is now available in Mockito. Even more - naturally Kotlin doesn’t have static methods, and it’s a good practice not to create them. Ideal code is code that follows the SOLID and Clean Architecture principles, which means it can be easily mocked and tested. Therefore, we, Android developers, don’t need PowerMock’s special features but it’s important to remember that such frameworks exist. Another Mockito’s limitation concerns work with coroutines and flows. In such cases, once again, mockito-kotlin as well as third-party libraries like turbine will help you out. This being said, I’d like to tell you about another alternative to Mockito, which is Mockk.
-
As an Android dev - which of these topics do you feel like you’re struggling the most with? What skills would you like to improve?
All you need: https://github.com/cashapp/turbine
-
Testing Kotlin Flows on Coroutines 1.6
You've essentially converged on what Turbine does.
- I'm getting an error that 'child jobs have not finished yet' while executing this test case. But i'm making sure that my child coroutine finishes before asserting the result. Any ideas?
-
Updating my tech stack: RxJava vs Flow
Turbine is an excellent library for testing flows and is pretty much required imo. But overall Rx is much easier to test; debugging works much more consistently and the built in testing functions are great.
-
JVM Testing Newsletter | July 2021
turbine release 0.6.0
-
Testing StateFlow
This issue on how StateFlows should be tested is probably also worth reading: https://github.com/cashapp/turbine/issues/19
-
From RxJava to Kotlin Flow: Testing
Use https://github.com/cashapp/turbine
What are some alternatives?
When comparing Kotest and turbine you can also consider the following projects:
spek - A specification framework for Kotlin
Reaktive - Kotlin multi-platform implementation of Reactive Extensions
mockk - mocking library for Kotlin
Kluent - Fluent Assertion-Library for Kotlin
kotlinx.coroutines - Library support for Kotlin coroutines
strikt - An assertion library for Kotlin
hamkrest - Hamcrest for Kotlin
junit-pioneer - JUnit 5 Extension Pack
mockito-kotlin - Using Mockito with Kotlin
compose-multiplatform - Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.