Torsten Curdt wrote:

It is useful for checking that we don't break anything
and also documents our learnings about what the code does. Starting to
write test code for allready existing code just because it "should be
tested" is more than "a lot of work" it is IMO pretty close to wasting
time.



May I now say... "Don't agree at all" ;)

It helps a lot(!) if you do refactoring.
How do you know whether it's working like
it was before? ...testing everything by hand?
...well, now that's what I would call a waste
of time ;)


If you reread the my message, you can see that we have about identical opinions about both why and that testing is useful for refactoring. ;)

Also I believe that it is a very good idea to write new code in a test driven manner.

The point I wanted to make is that I don't think it is a good use of our effort to start adding tests to existing code *only* because we would like to approach 100% test coverage. It will mean that you write tests without have any spcific usecase for them. OTH when you refactor or do new development you know what parts you are going to change or what you want new functionality you want to achieve, this makes it much easier to write high quality test cases as you actually have a use for them.

So I think it is much better use of ones limited time to refactor parts that are hard to understand or have unclear communication patterns between components, and add test cases as a part of the job, than just add test cases in general.

/Daniel





Reply via email to