mocktime
Mocktime is a term used in software development to describe techniques and tools that simulate or control the progression of time within a program. By decoupling code from the actual system clock, mocktime enables deterministic testing of time-dependent logic, such as expirations, timeouts, retries, and scheduled tasks.
Implementation generally provides a replaceable time source, often via dependency injection or monkeypatching, so production code
Applications span unit and integration tests, simulations, and event-driven systems where timing behavior is critical. Examples
Advantages include deterministic tests, faster execution, and easier reproduction of edge cases. Disadvantages include the risk
Related concepts include time mocking, fake timers, virtual time, and time travel testing.