On 10 Dec 2010, at 22:29, Andrew Wagner wrote:

> I went back and forth on whether to send this to this list or the ruby-talk 
> list, so feel free to tell me to take a hike...
> 
> I'm working on a personal project where I'm trying to keep a really high bar 
> on quality. One of the ways I'm doing that is to stick very close to the 
> BDD/TDD cycle as suggested in the RSpec book. However, I'm actually using 
> rspec for both the feature-level (BDD) tests and the unit-level (TDD) tests. 
> I'm also striving for 100% test coverage using Simplecov.
> 
> That said, I just realized that, to enforce that cycle, it's also important 
> that I ask "do my unit tests by themselves provide 100% test coverage?". 
> Because, otherwise, it's easy to get excited and write code to make the 
> feature past, that isn't TDD'd.
> 
> Anyway, all that to ask: is there some way to configure Simplecov to emit 
> code coverage stats for just a subset of all the tests that are running? That 
> is, I want to set up my rakefile such that it runs all my tests, but only 
> reports on code coverage for the unit tests.
> 
> Am I going about this with the right mindset? Any suggestions?

I haven't used simplecov myself, but I can answer the mindset question.

If I were you, I would want three numbers: the overall coverage from your unit 
+ functional tests, the coverage from your unit tests alone, and the coverage 
from your functional tests alone. As long as you're consistently working 
outside in, and driving each change to the code with *some kind of test* I 
would be happy with that, but it would be interesting to see where the coverage 
comes from.

As you learn to trust yourself to do things test-first, you'll find you need 
the code coverage figure less and less, because your conscience knows it's 
100%. These days, unless I'm rescuing a legacy project, I only really use code 
coverage to tell me about unused code that I can delete.

cheers,
Matt

m...@mattwynne.net
07974 430184

_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to