6 ms·
Whut? Listen kids, testing is a tool for HELPING THE DEVELOPER, not for using to engage in a "more pious than thou" dick-swinging my Cucumber is bigger than yo
by peteretep 15y ago
Whut?
Listen kids, testing is a tool for HELPING THE DEVELOPER, not for using to engage in a "more pious than thou" dick-swinging my Cucumber is bigger than yours idiocy.
Testing is about giving YOU THE DEVELOPER useful and quick feedback about if you're on the right path, and if you've broken something, and for warning people who come after you if they've broken something. It's not an arcane methodology that somehow has some magical "making your code better" side-effect...
The whole concept of "test driven development" is hocus, and I speak this as someone who writes a lot of tests, and who charges a lot of money for fixing test suites. Instead: developer-driven testing. Give your developers useful tools for solving problems and supporting themselves, rather than disappearing in to some testing hell where you're doing it a certain way because you're supposed to.
- Volpe 15y ago> The whole concept "test driven development" is hocus... I've worked on numerous projects where TDD has (and continues) to prove invaluable. So regardless how much experience you've got, I've had experience to the contrary, thus the "whole concept" isn't hocus. Why have you come to believe this?
- peteretep 15y agoIt's hocus where contrasted to developer-driven testing, because Test Driven Development - as a development methodology (as opposed to a tool) - espouses that you Write All Your Tests first. Have I had experience (and much value) out of sometimes writing tests for certain problem classes before writing any code? Yes. Changes to existing functionality are often a good candidate. Does TDD as a methodology suggest you should ALWAYS write your tests first? Everything I've read suggests so. And "as any fule kno" [sic], this is idioicy during a design or hacking or greenfield phase of development. Allowing your tests to dictate your code (rather than influence the design of modular code) and to dictate your design because you wrote over-invasive test. tl;dr: Writing tests before code works pretty well in some situations. Test Driven Development, as handed down to us mortals by Agile Testing Experts and other assorted shills, is hocus.
- elmomalmo 15y agoThis is a common misconception. TDD does not 'espouse' in any way that you write all your tests first. Nothing I have read suggests so. For me, TDD, in practice means switching back and forth between writing tests and production code. That is, write some test code, run, fail, fix the production code, write some more test code. It is incremental. EDIT: Fixed a typo
- Volpe 15y ago> Writing tests before code works pretty well in some situations. Test Driven Development, as handed down to us mortals by Agile Testing Experts and other assorted shills, is hocus. What? So it works in some situations, but not all. Thus hocus? I'm no 'Agile Testing Expert', but I have worked for the last 2-3 years doing TDD exclusively (as in ALWAYS writing tests first). It isn't hocus. It is effective. I can understand it doesn't suit all problems, and can potentially be a hinderance sometimes, but that is the same for ANY methodology/practice. I don't quite understand your hostility towards it. What do you mean by 'developer driven testing'?
- tomjen3 15y agoThe hocus is not that you can use TDD, if, in your professional judgment, you believe that to be the best solution to the problem. The hocus is that you must use it, because some guru said so.
- berntb 15y agoExcuse me for interrupting the budding flame war, but I have a question regarding the subject, which you seem qualified to answer? :-) My experience is the same as (what I believe is) the usual criticism of tests-first. I often need to rethink the API to my functions/methods, sometimes more than once. This goes for both external and internal APIs, so it doesn't help with detailed interface specifications between modules. Test-first is a problem, since it needs a fixed interface before I'm ready to lock down the interface. I tend to instead write inside-out; a few pages of code and then write tests for that code. That model isn't really kosher/halal/etc, according to TDD?
- smackay 15y agoThe issue/argument here is not that writing tests is worthless but that in many cases the approach of "if we write enough tests then the code that solves the problem will eventually emerge" is doomed to failure or at least results in an extremely verbose approach to development.
- zumda 15y agoBut then I think the approach is the wrong one. In TDD you are not required to write a lot of test and hope that they magically work in the future. Instead a small test to do one thing should be written, and then write enough code to make it pass. For example lets take a simple newsletter signup form with only a field to enter an email address. Now you shouldn't write a test to see what happens when you enter an email, a wrong email, if the confirmation email is sent, etc. Start with the simplest case: "If I fill in my email, and I press klick, then it should show me a confirmation that I singed up." Not more. Now make that pass, and you have working code! Now you can add tests that verify that a wrong or empty email is rejected, now make that pass. More working code! With TDD you should never end up with a lot of tests and no code that solves the problem. In that case you are actually writing too many tests and not enough code.
- bruceboughton 15y agoSure, if you need training wheels on your bike...
- prodigal_erik 15y agoWhich we demonstrably do as an industry. When neither NASA nor Knuth can write 100% correct code, the rest of us can't reasonably expect to pull it off. Human beings doing meticulous work make lots and lots of mistakes, and I welcome any feasible tactic that stops mine from being released. Sure, automating "I got a confirmation after pushing the button" seems hokey on day one (it's not as if you'd otherwise commit and go home before having seen it work) but somebody is eventually going to make a change that unexpectedly breaks it, and I want to know about it.
- jdlshore 15y agoI'm seeing a lot of misconceptions about test-driven development in this thread. The biggest one is that test-driven development involves writing a bunch of tests first. Instead, TDD involves interweaving tests and production code in a very tight cycle. You write a few lines of test code, then a few lines of production code, then you review and improve your code, then write a few lines of test code, and so forth. Each step only takes a minute or so. This is useful because you're constantly making and checking hypotheses: "This code should make a test fail in X way... yup. Okay, now this code should make the test pass. Yup. Now this change shouldn't change behavior, and the tests should still pass. Oops! Undo. Oh, that method has to be called in the constructor. All right, this change should work. Good." (If you're interested, my book goes into more detail, and it's online: http://jamesshore.com/Agile-Book/test_driven_development.html http://jamesshore.com/Agile-Book/test_driven_development.htm... . I also have a extensive screencast of real-world TDD here: http://jamesshore.com/Blog/Lets-Play/ http://jamesshore.com/Blog/Lets-Play/ ) Despite the extremists, TDD really is a useful tool--and that's all it is. Sure, TDD has been turned into yet another vehicle for programmers to engage in religious wars, but you can't really blame TDD for that, any more than you can blame Richard Stallman for emacs vs. vi wars.