Hacker News new | ask | show | jobs
by necovek 1827 days ago
TDD means writing tests before writing actual code, which presupposes writing very granular unit tests.

In practice though, what you want is sufficient coverage of your business logic. If you are well versed in TDD, your code architecture will be sufficiently decoupled even if you don't do TDD per se, so you should be able to test whatever is important for your application.

However, note that testing each layer independently generally gives you the best bang for the bug: trust that you can update code without worrying about breaking something. Then you only need minimal integration tests to ensure integration points are not broken.

What you describe sound like full system tests which are slowest, and you should have only a few of them in comparison, basically to replace manual QA.

Note that everybody uses slightly different definitions for which tests are which, but I hope you get the point.

1 comments

Is it wrong to start testing from the "Manual QA" point of view (But in reality automated.)?
There is nothing wrong about any approach: like everything in life, it's a balancing act.

If you want something maintainable in the long run (5-10 years), it's probably not the best idea to start with that approach. But then again, you probably have no idea what direction you should be heading for the next 5-10 years, so it's not a big deal.

I know it's a bit conflicting advice, but that's the point. When you know exactly what you are building (which is seldom the case with web apps), you want to do it right from the get go. When you don't really know, it does not matter since a few years down the line, if successful as a product, you'll be refactoring heavily and probably doing it the right way at that point (iow, full tests come last).