Thursday, August 31, 2006

Interview Excerpt: Gregory Brown (Test Coverage)

Gregory Brown is the lead developer of Ruport, a recent participant in the Google Summer of Code, and an all around nice guy. I'm wrapping up an interview with him (to be posted over at O'Reilly's Ruby Blog and the Apress Ablog shortly), and have a couple of questions and answers that just don't fit given the word count constraints. I didn't want to lose them though, Gregory's answers are just too good. So I decided to post them here. Enjoy.

You talked about your test coverage, how are you measuring it?

Gregory: We recently started using RCov to do code coverage reports. This gives us a great overview of what code isn't being touched by our tests, but does not give us much insight on whether the tests are of any real quality or completeness. Still, this tool is invaluable for identifying redzones which are a great first place to look for problems.

One thing about Ruport that is somewhat of an advantage as far as test coverage goes is that almost all development is done test-first. Sometimes, we have errors in our tests, or forget certain edge cases, or run into scenarios where refactoring leaves our tests no longer accurately reflecting the actual function, but this is usually because of our own mistakes, and not as a general principle.

Some of our stuff is very hard to test, like database interaction or sending email. I'd like to set up some mock objects for this and maybe use some dependency injection, but for now, we've just left these as red zones. In the mean time, we'll probably come up with some decent functional tests.

Another thing that we do is write tests to reproduce any bug reports we have. This seems to be a solid way to improve test coverage, and avoid the problem of recurrant bugs.

Digg this

No comments: