[rspec-users] A recently observed anti pattern: commented out tests

Todd Sedano todd.sedano at sv.cmu.edu
Mon Jul 23 17:07:06 UTC 2012

I must admit that I'm guilting of commenting out tests. I often do this
when I know that the code works, and I just upgraded some gem, and now one
of my tests no longer passes. I look at the test and realize that the
effort it would take to get the test to work outweighs the value that the
test provides me. (This is a general frustration for me that testing takes
more time than coding.)

I just did a quick scan of my main rails project (one that's been around
for four years) and has ~700 tests. I found two kinds of commented out
tests. About 12 of these commented tests look real and I should spend some
time and see why they are there. About 10 of these commented tests look
like I was brainstorming pending tests, I implemented them another way, but
never bothered cleaning them up.

In the spirit of clean code, I'll take a moment to clean house. Thanks

Todd Sedano
Director of Software Engineering
Carnegie Mellon University
Silicon Valley Campus
Developing Software Leaders (TM)
T: 650-335-2812

On Mon, Jul 23, 2012 at 9:19 AM, James Cox <james at imaj.es> wrote:

> Hey,
> in a bunch of the rescues i've recently done, I see a pretty big anti
> pattern: tests don't work, and so rather than making them work, the
> dev team just comments them out till 'later'.
> Does anyone think it'd be useful/interesting to get a flag for rspec
> which would compare lines vs lines-commented, and if the percentage
> was higher than xx, it'd issue some kind of warning?
> Best,
> james
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20120723/0fed7368/attachment.html>

More information about the rspec-users mailing list