Skip to main content Skip to docs navigation

Date/Time testing

TimeProvider and testing

Document not reviewed yet, might be outdated. Please, let us know if you find something invalid here.
On this page

Klock has utilities for providing time and there are some integrations for testing.


Sometimes you will need a source of time that can be mocked. Klock includes a TimeProvider interface with a default implementation using DateTime.

Testing & Kotest

Kotest is a flexible and comprehensive testing tool for Kotlin with multiplatform support. It supports Klock adding additional matchers. For a full list of Klock Kotest matchers, check this link:

And you can find a sample here:

Was this article useful?