# Tokio Authors - Unit Testing (Highlights) ![rw-book-cover|256](https://readwise-assets.s3.amazonaws.com/static/images/article0.00998d930354.png) ## Metadata **Review**:: [readwise.io](https://readwise.io/bookreview/57073269) **Source**:: #from/readwise #from/reader **Zettel**:: #zettel/fleeting **Status**:: #x **Authors**:: [[Tokio Authors]] **Full Title**:: Unit Testing **Category**:: #articles #readwise/articles **Category Icon**:: 📰 **URL**:: [tokio.rs](https://tokio.rs/tokio/topics/testing) **Host**:: [[tokio.rs]] **Highlighted**:: [[2025-12-25]] **Created**:: [[2025-12-27]] ## Highlights - However, internally, the time-related functionality of tokio supports pausing and resuming time. Pausing time has the effect that any time-related future may become ready early. ([View Highlight](https://read.readwise.io/read/01kdan01mmgznpakhz3hkma0zk)) ^969702378 `tokio::time::pause()` - For unit tests, it is often useful to run with paused time throughout. This can be achieved simply by setting the macro argument `start_paused` to `true` ([View Highlight](https://read.readwise.io/read/01kdamzqt0td6k97tenc01qhv7)) ^969702374 - To unit test the client connection handler, a [`tokio_test::io::Builder`](https://docs.rs/tokio-test/latest/tokio_test/io/struct.Builder.html) can be used as a mock ([View Highlight](https://read.readwise.io/read/01kdan1w4e67gbhdpdwd6dfp3r)) ^969702414