18 Error handling and testing

This chapter covers

  • Controlling the behavior of your code in the face of errors and exceptions
  • How error handling relates to the concept of structured concurrency
  • Writing code that behaves correctly when parts of your system fail
  • Writing unit tests for concurrent Kotlin code
  • Using the specialty test dispatcher to speed up test execution and testing fine-grained concurrency constraints
  • Testing flows with the Turbine library

Over the last few chapters, you’ve gotten an overview of the different aspects involved when writing concurrent code with Kotlin coroutines. To ensure the robustness of your applications, there is one more aspect that needs to be covered: How does your code behave when things go wrong?

Working ...

Get Kotlin in Action, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.