Currently, when I run code coverage analysis the reported coverage is 90%. The thing is that the other 10% is the code for the actual test!
How can i make VS ignore that test code and only take into account the actual code?
You can add a runsettings file in your project.
In that file you can mention DLL names which needs to be excluded from code coverage:
<ModulePaths>
<Include>
<!-- Include all loaded .dll assemblies (but not .exe assemblies): -->
<ModulePath>.*\.dll$</ModulePath>
</Include>
<Exclude>
<!-- But exclude some assemblies: -->
<ModulePath>.*\\Fabrikam\.MyTests1\.dll$</ModulePath>
<!-- Exclude all file paths that contain "Temp": -->
<ModulePath>.*Temp.*</ModulePath>
</Exclude>
</ModulePaths>
This page and This page should give you more details on how to add and how to configure runsettings file for unit tests.
Hope this helps you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With