From: David B Lightstone Date: 2001-12-08T03:55:14+09:00 Subject: [ruby-talk:27835] Re: John Roth dolt ( Re: A challenge to proponents of Unit Testing. ) "Thaddeus L Olczyk" wrote in message news:3c0fca7e.119078828@nntp.interaccess.com... > On Fri, 07 Dec 2001 15:28:15 GMT, "David B Lightstone" > wrote: > > > > >"Keith Ray" wrote in message > >news:k1e2i3t4h5r6a7y-4F0A2E.07090507122001@netnews.attbi.com... > >> In article , > >> stephen.hill@motorola.com (Steve Hill) wrote: > >> > >> > You might actually be surprised at how many tests are needed. In "The > >> > art of software testing" (Myers, 1979) the 1st chapter starts with a > >> > quiz.... > >> > > >> > What tests would you write for a function that takes 3 numbers (the > >> > side lengths of a triangle) , and returns whether the triangle is > >> > equilateral, scalene or isoceles. > >> > > >> > I think the answer is over 20.... certainly close on 20 > >> > > >> > Steve > >> > >> Kent Beck's response to that example: > >> > >> http://groups.yahoo.com/group/extremeprogramming/message/37242 > >> > >> "The biggest problem is that it doesn't balance the cost and benefits > >> of tests. He has a triangle example which he writes (I think) 29 > >> tests for. The test-first version can be done confidently with 5 > >> tests." > > ...doesn't balance the cost and benefits... > That's exactly what the anti-testing people say. > > > So what does it appear he does in typical managerial fashion he > tries to balance the equation by lowering the costs but doesn't > consider lowering the benifits. One might be tempted to say > that he is now getting caught up in the general XP cult like > behaviour; but I say: Everyone has an off day, and this might have > been one for him. Let us give him a chance to clarify his statement. Your suggesting, that it be treated as an off the cuff remark (my interpretation) is meaningful > > Oh yeah. And describe the five tests. > > > > > It is rather hard to access either your response or Mr Beck's intent. > >What to you believe? > > > >(1) Mr Beck may have read the 29 test cases and concluded that > >the 5 tests he favors are adequate. (the original 29 hasd redundancy) > > > >(2) Mr Beck may have read the 29 test cases and concludes that > >pruning a number of them was appropriate (impossible situations > >by virtue of a priori knowledge about other aspects of the system). > >(Hence he is doing integration testing, rather than unit testing) > > > >(3) Mr Beck may have determined that the customer can afford > >to take the risk because the expected loss associated with > >the pruned test cases is acceptable. > > > 4) He merges several test cases into one test case. Thus requiring the > same amount of work. > > The one thing I notice about each case is that they require you to > think of and dispose of cases. In others even though you don't write > them, you do have to expend considerable effort on them. > > The things is though ( and a major part of my original post ) is that > "only 5" sounds good until you think about it. > > Assume you have a small project of 1000 units. That means 5000 units > ( and that is assuming that 5 still holds I would expect other units > to be more complex requiring even more unit tests, the number > increasing exponentially with complexity. ) > > So now you need an infrastructure to handle 1000 units + 5000 tests. > That is what I see as the main problem with unit testing.