Testing with Schedulers
Testing is perhaps one of the most compelling scenarios where we can use Schedulers. So far in this book we’ve been coding our hearts out without thinking much about the consequences. But in a real-world software project, we would be writing tests to make sure our code works as we intend.
Testing asynchronous code is hard. We usually run into one of these problems:
-
Simulating asynchronous events is complicated and error prone. The whole point of having tests is to avoid bugs and errors, but if your tests themselves have errors, they’re not helping.
-
If we want to accurately test time-based functionality, automated testing becomes really slow. For example, if we need to accurately test that an error is called after ...
Get Reactive Programming with RxJS 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.