Hacker News new | past | comments | ask | show | jobs | submit login

> Time is a dependency like any other

Oh no... not at all. Here are some examples of when your approach turns out to be worthless:

* Performance testing, eg. looking for memory leaks. It doesn't matter how your timer ticks, what matters is that over time the system performance degrades.

* Any kind of hardware testing that relies on sensory input that is time-gated.

* Even "simple" stuff like testing software that does eg. desktop video recording. Still, you cannot substitute the wall clock with whatever timer you will come up with. I mean, in all those cases you "sort of" can, but that will render your tests worthless.

* Of course your home-made timers will prove useless if the tested software has third-party components that don't care about your timers.

Of course some cases can be handled by what you described, but, in my experience, when code works with time, the tests need to concentrate on special cases and those are usually hard to impossible to emulate through home-made timers. Or, they would benefit tremendously from time being real rather than a "surrogate".




None of the scenarios you listed above are unit tests, which I believe is what the OP and the post was referring to.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: