[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Unit test lines of code

benjohn

7/12/2007 2:28:00 PM


I'd like to know people's opinions.

I quite often find that when I'm doing TDD, I end up with as much test
code as implementation, or more.

I don't think I'm testing stupid things in my tests - I usually write
the tests incrementally, imagining I had the thing I'm testing, and
writing tests that exercise its functionality.

I've heard people say "those crazy unit test devotees - what's the point
if you've got more test code than implementation?!", and I wonder how
other people feel?

My take is it's probably a case by case thing, but in the cases I've
come accross, I've been very comfortable with greater lines of test code
than implementation. I've felt the balance is right.

Cheers,
Benj


1 Answer

Robert Dober

7/12/2007 2:44:00 PM

0

On 7/12/07, benjohn@fysh.org <benjohn@fysh.org> wrote:
>
> I'd like to know people's opinions.
>
> I quite often find that when I'm doing TDD, I end up with as much test
> code as implementation, or more.
>
> I don't think I'm testing stupid things in my tests - I usually write
> the tests incrementally, imagining I had the thing I'm testing, and
> writing tests that exercise its functionality.

I do not have a lot of experience let me just count
Project1 all tests running, testcode 1000 lines, production code 300 lines
Project2 all tests running, testcode 2000 lines, prod 1300 lines

However I feel that Project2 will end up with > 10klines of testcode
and <1kline of production code, because I need refactoring badly and
the testcases become fingerprints of the firewall rules on machines,
that means that the testcase is part of the production environment
which is quite nice to have but maybe an extreme case.
>
> I've heard people say "those crazy unit test devotees - what's the point
> if you've got more test code than implementation?!", and I wonder how
> other people feel?
No idea ;)
>
> My take is it's probably a case by case thing, but in the cases I've
> come accross, I've been very comfortable with greater lines of test code
> than implementation. I've felt the balance is right.
Agree with all these statements see above .
>
> Cheers,
> Benj
>
Cheers
Robert

--
I always knew that one day Smalltalk would replace Java.
I just didn't know it would be called Ruby
-- Kent Beck