• #kotlinDevChallenge 2023 summary

    #kotlinDevChallenge 2023 summary

    The KotlinDevChallenge was not just a competition, but a journey of learning, growth, and community engagement. Every participant in this challenge is a winner in their own right. By choosing to participate, you’ve taken a significant step towards enhancing your skills, pushing your boundaries, and becoming Kotlin PRO. The greatest reward is not just the…


  • How to mock data class?

    How to mock data class?

    Short answer: you don’t. Instead…


  • 4 Ways to Leverage Kotest Specs for More Robust Testing

    4 Ways to Leverage Kotest Specs for More Robust Testing

    When it comes to testing in Kotlin, we often default to jUnit as the go-to framework. However, there’s an alternative that offers a variety of powerful features – Kotest. Kotest provides a variety of spec styles, each with its unique capabilities, that make writing tests a breeze.


  • Are unit tests worth it?

    Are unit tests worth it?

    In the realm of software, unit tests are like unsung heroes. They quietly play a crucial role, ensuring that each part of the code, or each “atomic unit,” behaves as it should.  Let’s dive a bit deeper into this concept, keeping things simple and relatable. Imagine we’re talking about a car. Unit Tests: Checking the Basics…


  • StateFlow vs SharedFlow

    StateFlow vs SharedFlow

    What’s the difference between SharedFlow and StateFlow? That’s actually a very common interview question. And here’s how you can answer it: Both SharedFlow and StateFlow are hot streams, but they serve slightly different purposes. Let’s answer with practical examples to better understand their use cases. SharedFlow SharedFlow is like a broadcast channel. It can emit…


  • How to refactor your code (without turning the project inside-out)

    How to refactor your code (without turning the project inside-out)

    Are you stuck in a loop of having an old codebase that’s not testable, but not being able to refactor it because there’s no test coverage? This is a common challenge that many software development teams face, but there’s a way out. In this article, we’ll explore a 5-step process to break the cycle and improve…


  • Idiomatic Kotlin in tests: idiomatic stubbings

    Idiomatic Kotlin in tests: idiomatic stubbings

    In this article we will explore several ways of creating stubs… using Kotlin idioms.


  • Unit testing on Android – test pyramide

    Unit testing on Android – test pyramide

    Are you programming for Android and wondering how to write tests for your app? Or maybe you don’t have any tests in your project and don’t know how to live? Get to know my philosophy of creating tests for Android.


  • De-mock your tests: practical recipes

    De-mock your tests: practical recipes

    Examples of de-mocking test code as presented on Droidcon Berlin 2022.


  • Stubbing with doAnswer vs doReturn – what’s the difference?

    Stubbing with doAnswer vs doReturn – what’s the difference?

    Most of the times while stubbing with Mockito or MockK you will use doReturn construction. But do you know, that you can stub your test double method in other way – with doAnswer. Let’s take a look a both stubbing types.


  • How to mock final classes in Kotlin with Mockito?

    How to mock final classes in Kotlin with Mockito?

    Mockito cannot mock/spy because your class is final class? We can fix that.


  • How to use jUnit4 & jUnit5 in one project?

    How to use jUnit4 & jUnit5 in one project?

    When you have existing test suite containing jUni4 tests and you want to migrate slowly to jUnit5 to make use of new APIs and modern test engine, you may encounter some issues – not all tests will be visible in reports.


  • Libraries for Kotlin & JVM Testing

    Libraries for Kotlin & JVM Testing

    JVM and Kotlin testing libraries – Gradle dependencies and latest versions.


  • Don’t mock static: test Timber Logger with trees

    Don’t mock static: test Timber Logger with trees

    Learn how to create custom Timber Tree to test log outputs in unit tests. Mocking Timber, unit testing logs.


  • Don’t mock static: test SLF4J Logger with appenders

    Don’t mock static: test SLF4J Logger 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.