DEV Community

kreuzerk
kreuzerk

Posted on • Originally published at blog.angularindepth.com on

How to test Observables

The ultimate guide — never again be confused on how to test Observables

Reactive Programming is the new way of handling asynchronous code. And it is super powerful!

If you came across this blog post, I assume that you already wrote some lines of reactive code with RxJS if not a thousand. So I don’t have to tell you how it works and how cool it is. 😎

I guess we are all on the same page — writing productive code with RxJS is powerful and makes a lot of fun. But what about testing?

What we’re going to learn 👨‍🎓

In this blog post, we are going to see the two different strategies on how to test an Observable.

The “subscribe and assert pattern” and “marble testing”.

We will apply those strategies in different scenarios to see their advantages and downsides. The comparison of those strategies in different situations leads us to a clear picture of how to test Observables.

Find out more...

Discussion (0)