Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Code coverage

Code coverage

Scheduled Pinned Locked Moved C#
questioncsharpvisual-studiohelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    K v S
    wrote on last edited by
    #1

    I use the test runner of Visual Studio 2008, and I'm trying to get 100% code coverage with my unit tests in which I have almost succeeded. ;) However the last couple percent are a bitch. :sigh: I have some code in a base class that throws an error if some conditions are not met. This code is marked as only partially tested (beige). I know for a fact that this code is exercised several times during the tests. However there are some descendant classes that cannot cause condition that will lead to the execution of this particular section of code. Is this the reason I get the incomplete coverage result, and how do I cope with it?

    L 1 Reply Last reply
    0
    • K K v S

      I use the test runner of Visual Studio 2008, and I'm trying to get 100% code coverage with my unit tests in which I have almost succeeded. ;) However the last couple percent are a bitch. :sigh: I have some code in a base class that throws an error if some conditions are not met. This code is marked as only partially tested (beige). I know for a fact that this code is exercised several times during the tests. However there are some descendant classes that cannot cause condition that will lead to the execution of this particular section of code. Is this the reason I get the incomplete coverage result, and how do I cope with it?

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      K.v.S. wrote:

      Is this the reason I get the incomplete coverage result, and how do I cope with it?

      That is plausible. You could add tests for the base class itself. Or you could add another derived class that does need the specific base class code, and test it. :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups