Testing and Debugging Concurrent Code

One of the biggest challenges with concurrency is that bugs are often found late in the development process. Often, a concurrency error will first be seen in a production environment, when Murphy's law becomes a reality and all the things that can go wrong actually do go wrong.

This is because many of the bugs related to concurrency will happen during edge cases that either are thought of as impossible, or are so unlikely that they didn't even cross the minds of the developer or the code reviewers. This chapter aims to provide you with some advice on how to write tests that can help you to identify the scenarios you aren't prepared to handle, as well as some information on how to successfully write logs and debug your coroutines.

The topics in this chapter are interleaved with general advice that may not be directly related to coroutines. Writing proper tests and knowing how to debug are important and will help you build stable applications, and advice for proper testing is always relevant.

In this chapter, we will cover these topics:

  • Writing tests for concurrent code
  • Looking for edge cases
  • Enabling debug settings for coroutines
  • Using logs and breakpoints to debug coroutines
  • General advice for testing and debugging
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.99.71