Reputation: 4279
I am using Visual Studio 2015 and the Microsoft Unit Tests.
I pick 'Test->Analyze Code Coverage->All Tests' with no runsettings file. When the code coverage results appear I noticed one project (one dll) is not there. This is a project with no tests so I would expect it to show 0% coverage.
If I have no unit tests that reference a project will it not be included it in the code coverage results?
I added a quick test project with one test referencing the missing project and it is now included. We have people adding projects and need to make sure they have tests. A new project should show 0% if no tests are written. Is there a way to check all projects and report 0% if we have no tests?
Upvotes: 2
Views: 1530
Reputation: 375
I have the same question. I tried set that by *.runsettings file, that's doesn't work.
For this purpose, I just add empty internal class for Code Coverage. And write a unit test to access this empty class. I know this is not a good idea, but that could achieve this purpose.
Moreover, for testing an internal class. It must add
[assembly: InternalsVisibleTo("XXXXXXXXX")]
in AssemblyInfo.cs.
Upvotes: 1