News for hackers. Stuff that matters.
Re:Unit Testing Is Overrated by bpicolo on Thursday July 09, 2020 @08:27AM (#23779424)
Interactions with your DB are often the most fragile piece of your code, because there's an impedance mismatch between the language you're writing and SQL. Some languages/frameworks abstract this more safely than others, though.
Re:Unit Testing Is Overrated by Jtsummers on Thursday July 09, 2020 @10:55AM (#23780947)
Interaction, in general, is where many, if not most, errors lie. Unit testing verifies that things work in isolation. But if you code up your unit tests for two components that interact, but with different assumptions, then the unit tests alone won't do you any good: X generates a map like `%{name => string()}`, Y assumes X generates a map like `%{username => string()}`. Now, hopefully that won't happen if you're writing both parts at the same time, but things like this can happen. Now your unit tests pass because they're based on the assumptions of their respective unit of code, but put it together and boom!
Re:Unit Testing Is Overrated by 1337shadow on Thursday July 09, 2020 @09:13AM (#23779786)
Exactly, though I believe there's still a thin line between testing the interaction, and testing the db itself. Just like, the difference between testing some code, and testing the language itself.