4 ms·
Worse still, I feel like doing unit testing at the expense of integration testing can create a false sense of security. Unit tests often skip the error cases t
by lytefm 5y ago
Worse still, I feel like doing unit testing at the expense of integration testing can create a false sense of security.
Unit tests often skip the error cases that are really important for real life scenarios.
We've recently introduced a regression test suite for our data pipeline which simply compares all the data before with the data after running the pipeline. This gave us about 65% code coverage and the certainty that we're testing what actually matters for the product instead of how somebody decides to implement a function.
- voxic11 5y agoI feel the opposite way, with unit tests you can test failure scenarios as easily as any other scenario. So it makes it simple to exhaustively test every code path including failure scenarios that would be very difficult to set up in integration tests.
- mywittyname 5y agoThere are bugs that don't appear as such at the unit level. Two objects might individually be in perfectly valid states, but those states can be invalid at a system level. Which is why there can be a false sense of security with unit testing. When you see 100% code coverage, it implies that you've tested every possible scenario, but with most non-trivial software, you haven't. Did you test what happens when the methods are passed in 100GB of data?
- johndfsgdgdfg 5y agoFalse sense of security sold by conference indsutrial complex is my biggest issues with unit testing. One time I've seen a junior dev wrote copious amount of unit tests to achieve near 100% code coverage. When this "perfect" code went into prod it almost took the whole system down. Because the junior dev was joining close to a dozen tables and each one of the tables has at least a million rows. If the junior dev took the time to understand basic DB performance instead of writing dozens of unit tests, then it wouldn't have happened. I blame the gurus who don't write code for living, but peddle magic solutions like "clean code", unit testing etc. to sell more books and seminars.
- rat9988 5y agoI'm pretty sure if he didn't write the unit tests it would have equally failed. There is something to blame here, but not the unit tests.
- sharken 5y agoNo doubt the junior dev would benefit a lot more from only getting up to 60-70% code coverage. The extra time could then be used to learn basic Db performance, which is hugely important when tables have millions or billions of rows. Stuff like indexes and isolation levels should be taught to all junior devs, it's just too risky not to.