Cucumber Code Ratio
14 December 2009 in Agile Practice, Debugging, Distraction, TestingI wrote a quick and dirty rake task for grabbing the code ratio for cucumber. Here’s what I got for our one sprint old project:
Code Lines: 379
Test Lines: 431
Code to Test Ratio: 1.1
Update: Here is the ratio from a much larger project posted by co-worker, Clayton Ziingletwitch (thats “Clayton Lengel-Zigich” for those who don’t appreciate childish mockery. But come on Clayton, there’s so few names in the world, it just seems selfish to have so many):
Code Lines: 7443
Test Lines: 9593
Code to Test Ratio: 1.3
Generally I don’t care about test ratio, but I was interested in how many lines of test code it takes go get good coverage with cucumber vs. rspec. We are getting 87.7% code coverage with a 1.1 ratio. With rspec we would be looking at around 3:1 ratio to get similar coverage. Two thirds less test code to get high coverage? I’ll take it.
Here’s the code to generate the stats if anyone wants to use it. Just drop it in your project’s lib/tasks folder. The code assumes the default cucumber features folder setup.
Of course most BDDers will say that it isn’t enough to test with only cucumber - but I’m beginning to think that jumping to unit testing for every bit of code we write is akin to premature optimization. Regardless, I hope that anyone who has been burned in the past and is not testing because they are on a tight deadline: please consider fishing this baby out of the bath water.
1 Comment to Cucumber Code Ratio
Leave a comment
Tweets
- It's not the strongest of the species that survive, nor the most intelligent, but the ones most responsive to change."- Charles Darwin (link)
- Correction: Excellent software is the *byproduct* of excellent communication (link)
- @DayleyAgile thanks for the invite to speak at the Phoenix Scrum User Group on Feb 18th http://tr.im/NQuA #PhxSUG (link)
- I really enjoyed the scrum user's group #PhxSUG tonight. Stealing @AgileForAll's ideas for the retrospective tomorrow. (link)
- Thanks for the link @marick: "The estimate was awesome because the client was awesome." http://tr.im/KiYR (link)
- Introducing netrecorder, my first ruby gem.
3 January 2010 - How to build a ruby gem and host it on gemcutter
3 January 2010 - DEMO!
18 December 2009 - It puts the lotion on its skin
14 December 2009 - Cucumber Code Ratio
14 December 2009
- Chris Young:
Oh I see . . . Maybe I should check out this so-c... - Nicholas Orr:
Oh I see. I've read it a bit closer and there are ... - Chris Young:
Thanks Clayton, I updated the post.... - Clayton:
One problem I ran into using this guide is that yo... - Chris Young:
@Nicholas, I didn't go manual, I used 'echoe' - ma...
Here are the stats for my big project:
Code Lines: 7443
Test Lines: 9593
Code to Test Ratio: 1.3
Neat!