Member-only story

RxSwift Unit Testing Explained in 2 Minutes

Using RxTest and RxBlocking libraries

Zafar Ivaev
Better Programming
2 min readApr 2, 2020

Image source: Author

Today we will learn how to test our RxSwift apps using RxTest and RxBlocking libraries. Our sample project follows a reactive MVVM architecture.

The source code of the project is available at the bottom of the article.

Let’s Start

We have the following screen:

And the following structure inside the ViewController:

We can see that we have a UIStackView containing three UIButtons. The logic inside the ViewModel allows only one button to be selected:

Zafar Ivaev
Zafar Ivaev

Written by Zafar Ivaev

Senior iOS Engineer. I write about features of Swift and iOS development practices.

No responses yet

What are your thoughts?