I'm trying out TDD on some side project and already encountered this a couple of times.
As an example, my program needs to take a number X, and find out the date string that was X days ago, in order to perform certain date-based queries.
So I figured I need a test that validates the date computation is correct. But, since the test depends on the current date, how can create such a test?
I can have the test method implement this exact functionality by itself, but that would just make it redundant...
jeudi 24 mars 2016
TDD - how to test time-based functionality without implementing it within the test?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire