Marek Dominiak: Strategies for Dealing with Date and Time in Test and Production Code | JDD 2023

youtube.com 2 miesięcy temu


Back to the Future: Strategies for Dealing with Date and Time in Test and Production Code

Writing tests may sound easy, but writing good tests is actually hard. It's even more challenging to compose robust tests that consistently produce the same consequence each time they are run. In this talk, we will discuss how to compose tests that produce consistent results despite common issues related to date and time, specified as moving tests on February 28th, just before midnight, or across different time zones. We will take a look at how to simulate our code to run in the past or in the future (testing long-running processes aka Sagas). There are a couple of simple rules that can make those tests deterministic and more trustworthy. We will see examples of solutions that will lead to better unit and integration tests, and besides production code with examples in the Spring framework.

🚀 https://jdd.org.pl/