4 ms·
The Logic of Testing and the Testing of Logic
Business logic is slippery and changing (if it isn’t, you’re not in a business that will ever make any money).
- martinrue 14y agoThe key here for me is the emphasis on ensuring that code that carries risk (i.e. business logic) must be protected from regression – and that testing is a good way to achieve that, rather than preaching for a particular approach such as TDD/BDD/XDD. In reality I see quite a few successful approaches of reaching the goal of protecting code from regression and giving us the confidence to change it.
- sparknlaunch12 14y ago> "So, skip all your boilerplate framework tests if you like – if you don’t feel like you need them, you probably don’t. But please, please lock down your business logic in tests. Maintain them. They’re a working representation of what’s actually important." Business logic should always be the dominating force. This is often forgotten and the time you have 'real' users using the system it is too late to make sweeping changes.
- jwallaceparker 14y ago> And now I see it, I don’t understand why anybody could assert that writing tests is a bad idea. Great use of the word "assert" here - pun intended?
- seanhandley 14y agoOh my yes :-)
- PaulHoule 14y agoYep. From the viewpoint of a maintenance programmer, every artifact (file, class, method, function, test, etc.) is like a puppy you've adopted. It costs something to make, it will cost much more to maintain, and if you don't really need it, it does more harm than good. Per the Pareto principle, 20% of the tests deliver 80% of the benefits. Focus attention on: (i) tricky things (string parsing), (ii) security sensitive things, and (iii) fragile things (add tests when you fix a bug)
- evincarofautumn 14y agoThis article does a good job of separating the practical benefits of testing from the religion of it. You should write tests because they help protect you from silly mistakes, and automate things you would otherwise do by hand. Who could say no to that?
- sgerrand 14y agoSadly, this blog post appears to me as an over extrapolated version of "write tests for your code: you'll thank yourself later". I don't see what it adds to the topic, apart from a confessional component.
- seanhandley 14y agoFair comment (though I don't see what it adds to the discussion).