Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit test by skipping library functions for code coverage

I am trying to create a unit test in MS Test for a CMS application, wherein I have minority number of function that I wrote in my solution, the majority of the functions came along with CMS framework.

Issue:

When I take the code coverage it shows less than 1 percentage. But this coverage is meaningless.

Question:

How can I find coverage for only the functions that I wrote skipping the library functions that came along with cms framework?

like image 631
SmartestVEGA Avatar asked Jun 11 '26 15:06

SmartestVEGA


1 Answers

You can configure which assemblies your code coverage should look for.

You need to edit .runsettings file for the Unit tests and add this

<ModulePaths>
  <Exclude>
   <ModulePath>Name of the dll goes here</ModulePath>
   <!-- Add more ModulePath nodes here. -->
  </Exclude>
</ModulePaths>

For more information refer the link https://msdn.microsoft.com/en-IN/library/jj159530.aspx

like image 111
Ipsit Gaur Avatar answered Jun 14 '26 03:06

Ipsit Gaur



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!