I like unit testing. I’m not a hard liner so I don’t take it too seriously. I don’t necessarily fully subscribe to the test-first approach in all cases and I think aiming for 100% code coverage is rarely practical. But I do like unit tests. They give my a certain peace of mind and set a minimum standard for functionality.

But I just ran into a bug in my code that I didn’t catch in my unit tests but the end user caught pretty early on. Typing a decimal value into a field that was bound to an Int64 property on the viewmodel didn’t produce any error but simply reverted the field to zero. As the developer, it never occurred to me that someone would want to put a non-integer value in the field. I even guarded against negative integers.

Anyhow, the fix for now is “don’t type fractional minutes in the minutes field.” The bug is not particularly disruptive, just confusing. The nature of the field is such that a fractional minute is meaningless, but the end user is entering numbers directly off a bill which happens to have way more precision than is needed. It’s super low priority so I’ll queue it up for when other bugs need to be fixed. But I thought it was a great example of how developers can know the code inside and out, yet the end user will always find a bug you never even considered.