• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Debug It - recommendations for coverage

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

To reduce the number of bugs, (automated) unit testing is advised.

Given the rise of code coverage tools, when testing what, in your opinion, is an appropriate code coverage percentage for model, view, and controller code?

-Fred

 
author
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Interesting question, Fred.

It's easy to prove that achieving complete coverage for any nontrivial body of code is prohibitively expensive, but don't allow that theoretical limitation to put you off - it is possible to achieve close enough to complete coverage as to make no practical difference (testing "everything that could possibly break" in XP parlance).

I doubt that there's "one true" answer to what level of coverage is appropriate - it will depend upon your particular project. Having said that, with the widespread adoption of automated unit test frameworks these days, I would be disappointed to see any project with less than 90% coverage, and most should be able to do much better than this.

In the typical application, the area that's likely to be hardest to test is normally the view code. Whether this is a practical problem from a testing perspective depends upon how successful you've been at keeping your views "dumb". Assuming that you have managed to keep all your business logic out of the views, then an absence of comprehensive coverage is unlikely to be a big issue.
 
You don't know me, but I've been looking all over the world for. Thanks to the help from this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic