# From RxJava to Kotlin Flow: Testing

DevFeed: [From RxJava to Kotlin Flow: Testing](<https://devfeed.tech/articles/from-rxjava-to-kotlin-flow-testing-38631.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2020_03_05_from_rxjava_to_kotlin_flow_testing/>)

Published: 2020-03-05T00:00:00Z

Content type: comparison

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [kotlin-flow](<https://devfeed.tech/topics/kotlin-flow.md>), [RxJava](<https://devfeed.tech/topics/rxjava.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [compare](<https://devfeed.tech/tags/compare.md>), [error-handling](<https://devfeed.tech/tags/error-handling.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-flow](<https://devfeed.tech/tags/kotlin-flow.md>), [rxjava](<https://devfeed.tech/tags/rxjava.md>), [testing](<https://devfeed.tech/tags/testing.md>)

## AI overview

This article compares testing in RxJava and Kotlin Flow. It covers RxJava's TestObserver and TestScheduler, Kotlin Flow's TestCoroutineScope and TestCoroutineDispatcher, and examples of asserting stream values and completion.

## Source excerpt

Source This post is part of series of comparing RxJava to Kotlin Flow. Previous articles were about Threading, Backpressure, Error Handling, Stream Types, Throttling Introduction Testing is a crucial part of whole development. Testing allows you to write programs in a reliable fashion, prevent regressions and have many other goodies. I won't go through the list of advantages of writing tests in this article though. In testing it is important to have tools which allow you to write reliable tests and also tools which allow you to test your business logic. Business logic might be inside some function which calculates data and returns result, but also it might be some loading of data from network or doing some work in reaction to UI events. In places where we might have RxJava integrated. So it is very important to be able to test our rx-chains. In this article we'll go through the most important concepts in RxJava testing and compare it with what we have in Kotlin Flow.