DEV Community

Cover image for Top articles on KotlinTesting (2022)
Jarosław
Jarosław

Posted on

Top articles on KotlinTesting (2022)

1 Using Mockito in Kotlin projects

Refactoring Java Mockito based test suite to Mockito-Kotlin DSL
https://kotlintesting.com/using-mockito-in-kotlin-projects

2 Don't mock static: test SLF4J Loggers with appenders

Do you want to assert that SLF4J actually logged warn with proper message? Check this guide on how to mock logger in tests, in Kotlin and Java.
https://kotlintesting.com/mock-slf4j/

3 Mocking coroutines with MockK

How to easily stub or mock suspend function in Kotlin? MockK is the solution. See MockK examples for mocking coroutines.
https://kotlintesting.com/mocking-suspend-with-mockk/

4 How to mock final classes in Kotlin with Mockito?

Mockito cannot mock/spy because your class is final class? We can fix that.
https://kotlintesting.com/mock-final-in-kotlin/

5 Parameterized tests with Kotest

Creating parameterized tests in Kotlin: data driven testing, collection inspections and generating test cases with FreeSpec.
https://kotlintesting.com/kotest-parameterized/

Discussion (0)