Denis Haskin
2008-Apr-21 20:32 UTC
[Cruisecontrolrb-users] Fail build on code coverage level?
I''ve got rcov_rails as part of my continuous integration build, mainly thanks to [1] (edited it slightly to add a dependency db:test:prepare as the cruisecontrol.rb doc suggests. Can someone point me in the right direction to what I should do to make the code coverage level a criteria for a successful build? E.g. if code coverage is < 80% (or maybe even <80% for a given source file) then the build should fail; otherwise succeed (assuming the build+test itself suceed). Thoughts? Thanks -- dwh [1] http://deadprogrammersociety.blogspot.com/2007/06/cruisecontrolrb-and-rcov-are-so-good.html -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20080421/dcdfded6/attachment.html
Bryan Noll
2008-Apr-21 20:39 UTC
[Cruisecontrolrb-users] Fail build on code coverage level?
Couldn''t you just check in a test that runs `rcov blah ...` somewhere and then parses through the results, checking for the percentage value you''re interested in. If said percentage value is less than X... assert(false, "You don''t have enough tests!") Denis Haskin wrote:> I''ve got rcov_rails as part of my continuous integration build, mainly > thanks to [1] (edited it slightly to add a dependency db:test:prepare as > the cruisecontrol.rb doc suggests. > > Can someone point me in the right direction to what I should do to make > the code coverage level a criteria for a successful build? E.g. if code > coverage is < 80% (or maybe even <80% for a given source file) then the > build should fail; otherwise succeed (assuming the build+test itself > suceed). > > Thoughts? > > Thanks -- dwh > > [1] > http://deadprogrammersociety.blogspot.com/2007/06/cruisecontrolrb-and-rcov-are-so-good.html > > > ------------------------------------------------------------------------ > > _______________________________________________ > Cruisecontrolrb-users mailing list > Cruisecontrolrb-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users
Chad Woolley
2008-Apr-22 01:37 UTC
[Cruisecontrolrb-users] Fail build on code coverage level?
On Mon, Apr 21, 2008 at 1:39 PM, Bryan Noll <bwnoll at gmail.com> wrote:> Couldn''t you just check in a test that runs `rcov blah ...` somewhere > and then parses through the results, checking for the percentage value > you''re interested in. > > If said percentage value is less than X... assert(false, "You don''t have > enough tests!")Or run this test (or something that just raises an exception if coverage is low) only as part of a separate rake task, which runs after your rcov task (both called from default cruise task) -- Chad
Denis Haskin
2008-Apr-22 13:37 UTC
[Cruisecontrolrb-users] Fail build on code coverage level?
Thanks to you both -- I''ll give that a shot today. dwh Chad Woolley wrote:> On Mon, Apr 21, 2008 at 1:39 PM, Bryan Noll <bwnoll at gmail.com> wrote: > >> Couldn''t you just check in a test that runs `rcov blah ...` somewhere >> and then parses through the results, checking for the percentage value >> you''re interested in. >> >> If said percentage value is less than X... assert(false, "You don''t have >> enough tests!") >> > > Or run this test (or something that just raises an exception if > coverage is low) only as part of a separate rake task, which runs > after your rcov task (both called from default cruise task) > > -- Chad-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20080422/9194da19/attachment.html
Tim Harding
2008-Apr-22 15:06 UTC
[Cruisecontrolrb-users] Fail build on code coverage level?
Just found this: "The answer is vl_cruise_control, a Rails plugin that uses rcov to enforce a coverage target, and causes CC.rb to mark a build as failed if that target isn''t met. So in addition to regularly checking that all the tests pass, we also check that all (or substantially all) of our code is accounted for in our tests. " Here: http://www.viget.com/extend/tools-of-the-trade-vl-cruise-control/ That looks like a really nice way of doing what you want... haven''t tried it. On Tue, Apr 22, 2008 at 2:37 PM, Denis Haskin <denis at haskinferguson.net> wrote:> Thanks to you both -- I''ll give that a shot today. > > dwh > > Chad Woolley wrote: > > On Mon, Apr 21, 2008 at 1:39 PM, Bryan Noll <bwnoll at gmail.com> <bwnoll at gmail.com> wrote: > > > Couldn''t you just check in a test that runs `rcov blah ...` somewhere > and then parses through the results, checking for the percentage value > you''re interested in. > > If said percentage value is less than X... assert(false, "You don''t have > enough tests!") > > > Or run this test (or something that just raises an exception if > coverage is low) only as part of a separate rake task, which runs > after your rcov task (both called from default cruise task) > > -- Chad > > > _______________________________________________ > Cruisecontrolrb-users mailing list > Cruisecontrolrb-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20080422/cd5ac558/attachment.html
Tim Harding
2008-Apr-22 15:08 UTC
[Cruisecontrolrb-users] Fail build on code coverage level?
But then I don''t know anyone that uses Ruby for non-Rails development and the two are nearly synonymous for me, I guess you might not be a Rails developer. On Tue, Apr 22, 2008 at 4:06 PM, Tim Harding <tim.harding at gmail.com> wrote:> Just found this: > > "The answer is vl_cruise_control, a Rails plugin that uses rcov to enforce > a coverage target, and causes CC.rb to mark a build as failed if that target > isn''t met. So in addition to regularly checking that all the tests pass, we > also check that all (or substantially all) of our code is accounted for in > our tests. " > > Here: > > http://www.viget.com/extend/tools-of-the-trade-vl-cruise-control/ > > That looks like a really nice way of doing what you want... haven''t tried > it. > > On Tue, Apr 22, 2008 at 2:37 PM, Denis Haskin <denis at haskinferguson.net> > wrote: > > > Thanks to you both -- I''ll give that a shot today. > > > > dwh > > > > Chad Woolley wrote: > > > > On Mon, Apr 21, 2008 at 1:39 PM, Bryan Noll <bwnoll at gmail.com> <bwnoll at gmail.com> wrote: > > > > > > Couldn''t you just check in a test that runs `rcov blah ...` somewhere > > and then parses through the results, checking for the percentage value > > you''re interested in. > > > > If said percentage value is less than X... assert(false, "You don''t have > > enough tests!") > > > > > > Or run this test (or something that just raises an exception if > > coverage is low) only as part of a separate rake task, which runs > > after your rcov task (both called from default cruise task) > > > > -- Chad > > > > > > _______________________________________________ > > Cruisecontrolrb-users mailing list > > Cruisecontrolrb-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/cruisecontrolrb-users > > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20080422/873988f6/attachment.html
Denis Haskin
2008-Apr-22 17:29 UTC
[Cruisecontrolrb-users] Fail build on code coverage level?
Thanks for the pointer, I will look at it (weird that it didn''t come up in any of my googling). And yes, we''re doing Rails. Thanks, dwh Tim Harding wrote:> But then I don''t know anyone that uses Ruby for non-Rails development > and the two are nearly synonymous for me, I guess you might not be a > Rails developer. >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/cruisecontrolrb-users/attachments/20080422/de1e9cfd/attachment.html