Hacker News new | ask | show | jobs
by jamil7 2418 days ago
> who cares if some function in your backend code does weird things when it takes a malformed string

I would argue you need both. Without that unit test you might find it difficult to account for or track down that particular edge case. Plus a test like that takes about 5 minutes to write.

1 comments

Agreed you definitely need both, but one is much more important to your company's continued existence.

To be fair, current best practice is to not write those tests at all, but to generate them and embrace the property based testing paradigm (ala quickcheck[0]). Put simply -- let the computer make random inputs and make sure your program maintains the proper invariants.

[0]: https://hackage.haskell.org/package/QuickCheck