Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoGeneratedProgram included into coverage #604

Closed
Tum4ik opened this issue Nov 3, 2019 · 2 comments
Closed

AutoGeneratedProgram included into coverage #604

Tum4ik opened this issue Nov 3, 2019 · 2 comments
Labels
question This issue is a question

Comments

@Tum4ik
Copy link

Tum4ik commented Nov 3, 2019

I've included the test project itself into code coverage via /p:IncludeTestAssembly=true, but there is strange file generated AutoGeneratedProgram and it breaks the real coverage results.

Here is how it looks in the report:

image

Here are the datails:

image

The question is: how could I avoid that?
Thanks.

@MarcoRossignoli
Copy link
Collaborator

MarcoRossignoli commented Nov 4, 2019

yep you can exclude types using filter https://github.com/tonerdo/coverlet/blob/master/Documentation/MSBuildIntegration.md#attributes

I think that in your case you can use /p:ExcludeByAttribute="TestSDKAutoGeneratedCode"

Or you can skip source file name /p:ExcludeByFile=\"**/Microsoft.NET.Test.Sdk.Program.cs\"

Or type /p:Exclude="[Tum4ik.RemoteControl.TopicsAndPayloads.UnitTest]AutoGeneratedProgram"

To check filters and exlusion try to enable msbuild logs and check https://github.com/tonerdo/coverlet/blob/master/Documentation/Troubleshooting.md#msbuild-integration

@MarcoRossignoli MarcoRossignoli added the question This issue is a question label Nov 4, 2019
@Tum4ik
Copy link
Author

Tum4ik commented Nov 4, 2019

Nice! Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question This issue is a question
Projects
None yet
Development

No branches or pull requests

2 participants