General Feedback

Use at compile time to report coverage per cs file?

Started by samJones on 7,992 views

ncrunch rocks!

One of our goals is to set up the build system/CI system to have a list of units and required coverage level per unit. E.g.

fileA.cs, 100
fileB.cs, 90
fileC.cs, 95

etc

So as we get coverage addressed (using ncrunch), we can enforce a certain level of coverage at build time. (e.g. if fileC.cs drops to %94 coverage, build fails)

Can ncrunch help us here?
samJones wrote:ncrunch rocks!


Thanks! :)

samJones wrote:
One of our goals is to set up the build system/CI system to have a list of units and required coverage level per unit. E.g.

fileA.cs, 100
fileB.cs, 90
fileC.cs, 95

etc

So as we get coverage addressed (using ncrunch), we can enforce a certain level of coverage at build time. (e.g. if fileC.cs drops to %94 coverage, build fails)

Can ncrunch help us here?


NCrunch doesn't have anything that will do this out of the box, but it should be possible to implement your own solution by parsing the reports output by the NCrunch console tool on your CI server.

I recommend taking a look at the contents of these files. One of them is a raw code coverage XML data file that could easily be read by your own tool which is programmed with rules detailing code coverage targets per method. When one of the rules is broken, the tool could return a non-zero response and fail the build.
[size=8]Parsing xml sounds doable.

Question is... how do we even run ncrunch on build system?

Currently, the process is:

[list=1]
  • msbuild -- solution
  • run a bunch of nunit console apps // built by solution, if one fails the build fails


  • What would it look like in an ncrunch context?

    Post a reply

    Log in to reply.