# Fast Reactor Tests With Virtual Time

DevFeed: [Fast Reactor Tests With Virtual Time](<https://devfeed.tech/articles/fast-reactor-tests-with-virtual-time-17700.md>)

Original publisher: [Read original article](<https://nexocode.com/blog/posts/fast-reactor-tests-with-virtual-time/>)

Author: piotr-kubowicz

Published: 2021-12-27T00:00:00Z

Content type: tutorial

Language: en

Sources: [Backend Development on nexocode](<https://devfeed.tech/sources/backend-development-on-nexocode.md>)

Topics: [reactive](<https://devfeed.tech/topics/reactive.md>), [Testing](<https://devfeed.tech/topics/testing.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Concurrency](<https://devfeed.tech/topics/concurrency.md>), [Code](<https://devfeed.tech/topics/code.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [asynchronous](<https://devfeed.tech/tags/asynchronous.md>), [code](<https://devfeed.tech/tags/code.md>), [concurrency](<https://devfeed.tech/tags/concurrency.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [network](<https://devfeed.tech/tags/network.md>), [programming](<https://devfeed.tech/tags/programming.md>), [reactive](<https://devfeed.tech/tags/reactive.md>), [reactive-programming](<https://devfeed.tech/tags/reactive-programming.md>), [reactive-streams](<https://devfeed.tech/tags/reactive-streams.md>), [testing](<https://devfeed.tech/tags/testing.md>), [timeout](<https://devfeed.tech/tags/timeout.md>), [unit-test](<https://devfeed.tech/tags/unit-test.md>)

## AI overview

This tutorial explains how to use Project Reactor's Virtual Time and StepVerifier to test delayed and asynchronous reactive code without waiting for real time to pass. It also discusses controlling external storage behavior and the limitations of polling-based test approaches.

## Source excerpt

Sometimes your code deals with a situation when things happen slowly. Maybe you schedule a background task that runs after some time. Or run a special action when asking for data that takes far too long. Either way, it is a tricky case that needs to be tested well. But what to do if we don't want a test that waits a lot? Project Reactor, a reactive programming library for JVM, handles concurrency in a high-level and declarative fashion. Its test utility, StepVerifier, allows using Virtual Time: 'mock' the clock and advance time in your tests faster than the system clock runs.