4 ms·
A better way to test it would be to deterministically generate the days that you want to test with. That might be one date for each day of the week, or one dat
by mason55 11y ago
A better way to test it would be to deterministically generate the days that you want to test with. That might be one date for each day of the week, or one date for each day of the year, or some set of dates that include some normal dates and edge cases like leap days.
The problem with having non-deterministic tests is that when they break you don't know if it's because the test broke or the code broke and even if it was the code you don't know when it broke.
What if someone checked in a change that broke how things were handled on Sundays but the tests were only run on Sundays once/year? You'd have to run each build through the test suite, one by one, and you'd have to do it on that day, just to figure out which check in broke.