RxJS unit testing in Angular application.

In-depth look in RxJS unit testing

All possible methods to do unit tests for RxJS code in Angular

Simplest async testing with Jasmine ‘done’ callback

Testing by using virtual time (RxJS VirtualTimeScheduler) and fake time (Angular fakeAsync helper)

How to avoid additional arguments in methods under test by using AsyncScheduler/delegate trick

What is difference between VirtualTimeScheduler and TestScheduler

What is marble testing and how to use progressive time syntax in marble diagrams

How to reduce code boilerplate by using wrapper libs like jasmine-marbles and rxjs-marbles

What is difference between testing with TestScheduler flush() and new TestScheduler run() method?

Angular demo project with all reviewed code


  • Intermediate-advanced level of RxJS
  • Intermediate-advanced level of Angular


If you already tried to code unit tests for Observables – then you may be overwhelmed with a variety of methods on how to do that.

Which one is right for you?

Will it be jasmine with ‘done’ callback which we usually use for async code?

Or maybe TestScheduler?

Or you are going to use jasmine-marbles which is being mentioned in official Angular documentation?

I am not even naming other methods.

What is common for them and where they differ? How to put all of them in one solid picture in your head?

This is what I am going to do in my lessons – I will make you understand the system.

Who this course is for:

  • Intermediate-advanced Angular developers
  • RxJS enthusiasts

Course content

4 sections • 11 lectures • 54m total lengthExpand all sections

Introduction2 lectures • 8min

  • Introduction02:04
  • RxJS Schedulers05:40

Testing only final result by virtual time and fake time4 lectures • 21min

  • Testing with Jasmine ‘done’ callback05:52
  • Testing by using RxJS VirtualTimeScheduler07:32
  • Testing by using Angular fakeAsync function04:40
  • VirtualTimeScheduler vs TestScheduler in RxJS03:01

Marble testing4 lectures • 23min

  • Marble testing with TestScheduler07:43
  • Marble testing with jasmine-marbles03:28
  • Marble testing with TestScheduler.run06:04
  • Marble testing with rxjs-marbles lib05:23

Conclusion1 lecture • 3min

  • To wrap up03:19