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
- study: "In 2 years, work perf of high school recruited devs indistinguishable from more experienced peers"(paraphrase)http://tcrn.ch/daXoHA (link)
- Attention Software Developers: We better be rich before we turn 50 http://tcrn.ch/daXoHA :( (link)
- @integrum was mentioned in the devshow podcast #14 for its hiring practice of having developers download a project from Git and re-factor. (link)
- @supairish good point! (link)
- Like the unobtrusive js in Rails 3 but stuck on 2.3.dumb? Just include Rv3 jquery adapter (a .js file) in ur project! http://bit.ly/bqjVGH (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
- Tobi:
^^ shit, ok now I see it's not your fault, its (my... - Tobi:
Thanks for this great writeup! btw. you missed... - Chris Young:
Thanks for letting me know. I updated the link.... - maxjgon:
The link of the project in Github is broken!... - Chris Young:
Oh I see . . . Maybe I should check out this so-c...
Here are the stats for my big project:
Code Lines: 7443
Test Lines: 9593
Code to Test Ratio: 1.3
Neat!