GlobeTownDevs / stopwatch

Stopping your watches
0 stars 1 forks source link

Testing for errors when input is not a number #10

Open marisid opened 8 years ago

marisid commented 8 years ago

Isn't this satisfied by just testing for different cases (such as checking for correct display of ms,s,min,h)? It was not clear to me how this test came as a requirement for your functionality rather than as a bug fix at some point?

tbtommyb commented 8 years ago

It is because we had a bug where the output in the timer was NaNNaN:NaNNaN etc and it took us a while to follow the code through and see where exactly the NaNs were coming from.

It turned out to be coming from the getTimeDiff so we wrote a test for it to validate its inputs so that in future we would know if that function was causing problems.

Testing for the correct display shows you that the overall code works as intended, but I think unit tests should try and catch potential bugs too.