3 ms·
In my experience unit testing has less value than end-to-end testing. Unit tests rarely break and the reasons it break is not something that you couldn't guess.
by msoad 12y ago
In my experience unit testing has less value than end-to-end testing. Unit tests rarely break and the reasons it break is not something that you couldn't guess. In contrast end-to-end tests fail with a big surprise! I always enjoy seeing my end-to-end tests catching errors that I would never ever thought of.
The down side of end-to-end tests is that it's slow to develop and slow to run. Because in many cases, end-to-end tests should be sequential and involves network calls and browser rendering. In general it's worth it.
- ipedrazas 12y agoI would say that it's more than that. End-to-end is the only test that reproduces a real case scenario.
- mattnewton 12y agoI often suffered from that problem with unit tests - if you thought of writing the test, you could have written that case into your code, making it only really useful for regression testing. It doesn't help you discover bugs that are there that you didn't think of. Integration testing helps with that because you test multiple parts together, which is hard to hold in your head and chances are you'll find problems you hadn't thought of while programming. But failing integrations tests can be tricky to diagnose the root problem, especially compared to unit tests, and require a lot of code to be written or stubbed before they can be used. So, I've been trying to adopt "property" based testing where you test invariants of the output with pseudorandom inputs, a-la quick check in haskell. Big shoutout to http://jsverify.github.io/#jsverify http://jsverify.github.io/#jsverify :) While it can certainly be hard to apply to problems or find some useful invariants, It's been enormously successful in finding bugs I didn't think of, and shrinking is an elegant solution to making failures more easily diagnosable.