Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Use at compile time to report coverage per cs file?
samJones
#1 Posted : Friday, June 17, 2016 7:15:20 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/17/2016(UTC)
Posts: 8
Location: United States of America

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?
Remco
#2 Posted : Friday, June 17, 2016 11:41:44 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
samJones;8852 wrote:
ncrunch rocks!


Thanks! :)

samJones;8852 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.
samJones
#3 Posted : Friday, June 17, 2016 11:55:11 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 6/17/2016(UTC)
Posts: 8
Location: United States of America

Parsing xml sounds doable.

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

Currently, the process is:

  1. msbuild -- solution
  2. 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?
Remco
#4 Posted : Saturday, June 18, 2016 3:22:10 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.034 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download