Typical size of unit tests compared to test code
Posted
by Frank Schwieterman
on Stack Overflow
See other posts from Stack Overflow
or by Frank Schwieterman
Published on 2010-04-13T23:19:02Z
Indexed on
2010/04/13
23:23 UTC
Read the original article
Hit count: 356
TDD
|unit-testing
I'm curious what a reasonable / typical value is for the ratio of test code to production code when people are doing TDD. Looking at one component, I have 530 lines of test code for 130 lines of production code. Another component has 1000 lines of test code for 360 lines of production code. So the unit tests are requiring roughly 3x to 5x as much code. This is for Javascript code. I don't have much tested C# code handy, but I think for another project I was looking at 2x to 3x as much test code then production code.
It would seem to me that the lower that value is, assuming the tests are sufficient, would reflect higher quality tests. Pure speculation, I just wonder what ratios other people see.
I know lines of code is an loose metric, but since I code in the same style for both test and production (same spacing format, same ammount of comments, etc) the values are comparable.
© Stack Overflow or respective owner