Category: Kotlin | Format: Session
11:00 am - 11:40 am | Hawecha
Fake it till you test it
When writing unit tests, it is often necessary to create disposable objects that mimic the behavior of real dependencies. These objects, known as test doubles, can help us to isolate our tests and ensure that they are testing the correct behavior or state of the system under test. In this talk, we will explore the different types of test doubles, discuss the pros and cons of each type of test double, and provide examples of how they can be used in Kotlin. We will also revisit the old debate between mocks and fakes, and argue that fakes are often a better choice for Kotlin projects. This is because fakes are easier to write and maintain, and they can be used to express the behavior of real dependencies in a more precise way. Finally, we will give examples of how to use Kotlin to write fakes. We will show how to use Kotlin functional programming features to create fakes that are easy to read and understand.