Our unit tests most often specify the expected behavior of a piece of code by defining example scenarios. Each test is a single concrete scenario. When the test suite succeeds, we get the impression that our application works as intended, also for other possible input values. That is, however, not at all guaranteed. It is easy to miss errors due to edge cases that the developer didn’t think about or lack of coverage in the chosen inputs. In this talk, I will introduce you to property-based testing and how it differs from the more common example-based testing. This testing approach lifts testing to a higher level of abstraction and leaves it to generators to come up with concrete scenarios. The result is a cleaner and more compact test suite that is easier to maintain and better exposes subtle bugs. The hard part of property-based testing lies in defining the suitable properties, and we will look at the best practices to do that properly. Kotest offers a property test framework that includes generators, shrinkers, and everything else you need to start property-based testing. During my talk, we will see many of its features. We also learn how extension functions and other language features can make our tests even more readable. Don’t you use Kotest? No worries! The property test framework is compatible with JUnit and any other test framework. -- Advanced Kotlin Dev Day 2022 was organized on 24 November 2022 by Xebia. This event took place in the Q-Factory in Amsterdam. -- Xebia It's your business, we accelerate it. We are a group of highly ambitious craftsmen. From digital strategy to technology implementation. As such we are a one stop shop for full stack digital transformation. We provide innovative solutions and services to help your organization become a digital winner. Check out Xebia online: Website - LinkedIn - Twitter - Facebook - YouTube -
Hide player controls
Hide resume playing