On Tue, 15 Feb 2005 18:32:46 -0500, Stefano Mazzocchi <[EMAIL PROTECTED]> wrote: > Gianugo Rabellino wrote: > > On Tue, 15 Feb 2005 11:37:18 -0500, Stefano Mazzocchi > >>So, all right, fix the code in eclipse, change to the terminal, run ant, > >>hit cocoon-reload (twice! that stupid ehcache thing in the way), say > >>"thanks sylvain" ten times (instead of a thousand, that's why you say > >>that ;-), another stacktrace... go back to square one. One modification > >>per minute... and I'm used to one modification every 5/10 seconds in > >>debug mode. > > > > Here I have to agree with Ugo. Unit testing can make a change: > > I took one generator, merged it with another, and updated the library > that they used (because I needed a new feature) and now it throws > IllegalArgumentExceptions.
Curious: what was the problem actually? > 'unit' testing is about testing units, isolated functional pieces that > can be considered passive and tested independently. > > Cocoon's internals are *far* from being that kind of unit. You can't > test a single method of a SAX content handler, that gives you nothing! > > You can test the input and output of a pipeline, but this is exactly > what I do with my browser when I hit it! Sure I can automate that when > it's ready to know what is broken or not later on, but it's not unit > testing, is functional testing... and helps when you are doing > modifications, but doesn't help at all when you are implementing new > features (or merging different existing ones). Sorry Stefano, but I feel that you are somewhat biased. :-) I'm not saying unit tests are the solution to all evil, and I certainly understand that within the *current* Cocoon environment unit tests might not help much. But this is because the current codebase isn't test-friendly, so that it makes really little sense to test a single unit of functionality when 99% of what is around just can't be tested. This is *not* because testing doesn't work or can't be applied: actually in your case it would have been of great help. You were extending an existing component, and if you were starting from a tested codebase, you could have perfomed your changes incrementally, ensuring that you weren't breaking anything and inserting new tests while adding new functionalities. I'm positive that your IllegalArgumentException would have shown up much earlier and in a much faster try/fail environment (no need for a code/servlet-stop/compile/servlet-start/test/fail/swear cycle). However, this has bitten me sorely in the past. So much that as of today I generally develop a POJO with test in mind, and only when it's solid enough to satisfy me I refactor it to a Cocoon component proper. It's not that hard once you get used to it. But it's suboptimal indeed. More on the rest later, time to sleep in this part of the world. :) -- Gianugo Rabellino Pro-netics s.r.l. - http://www.pro-netics.com Orixo, the XML business alliance: http://www.orixo.com (blogging at http://www.rabellino.it/blog/)
