Get Percentage Code Coverage With FxCop

I am currently trying to write a unit test library for a code base in C #. I want to see the percentage of code coverage that my tests achieve. I am using VS2010, which has no built-in code analysis tools. I downloaded FxCop and included it in an external tool in VS2010, but I do not know how to get the percentage of code coverage. I believe that this will be done by setting the rules for this, but I'm not sure. I looked at the ruleset and how to create custom rules, but I'm not sure how to implement them or which ruleset libraries I use.

I am completely new to FxCop and external analysis tools in general, so step by step or any direction you can give would be great!

+4
source share
2 answers

As far as I know FxCop, any version, even the latest CodeAnalysis 2017, does not import code coverage data.

You can try the NDepend tool . It can import code coverage data from VisualStudio, NCover, and dotCover coverage. Then you can use the code coverage data as follows:

  • Write a rule that checks that all classes with a specific attribute (for example, an attribute named FullCoveredAttribute) are 100% covered
  • , , , 100% , 100% (NDepend )
  • , Cyclomatic Complexity, , 100 %
  • treemaping. - . # , % ( = 100% = 80% = 0%)

NDepend metric treemap color code coverage

0

, . FxCop - . XY.

0

Source: https://habr.com/ru/post/1679084/


All Articles