-
Notifications
You must be signed in to change notification settings - Fork 386
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
Question about code coverage of test assemblies #1571
Comments
Hi, there are some limitations e.q. generated code for test projects. You can use see also coverlet CI:
|
I have nothing to do with GeneratedCodeAttribute. One test assembly references other test assembly - that is all. |
Please provide more details. In the past we had similar issues and some were created by Microsoft.Net.Test.Sdk code generation. |
I know about report generator and use it. The question is about coverlet behaviour, not reportgenerator. What details I can provide? I already said that situation is very simple - when one test project become reference other test project then I see coverage for referenced assembly even when it was excluded by filter like |
Sorry, but could you please explain the target element for the filter e.g. file names will not work. example exclude filter used in coverlet CI
|
@sungam3r I think this comment here explains it (#1503 (comment)).
Yes it is the expected behavior.
Yes exactly. It only works for the test assembly being executed. If the root-(test)-assembly references other assemblies we can't really distinguish whether it is a test assembly or not.
It may be best for your scenario to exclude the assembly with the test models by using filters. The other option would be to really separate the test assemblies in a way that they don't reference each other. Have I been able to clarify all questions? |
@daveMueller Thank you, this is exactly what I expected to hear. I had to make sure that coverlet works just like that. |
Hi. I know that coverlet excludes test assemblies by default thanks to default value for
IncludeTestAssembly
setting. Nevertheless I've noticed that in some test reports for projects in our codebase there are still test assemblies likeCompany.CoolFeature.UnitTests
. After investigation I found that this test assembly is referenced by another test assembly from repo. Why? Well, for example, becauseCompany.CoolFeature.UnitTests
shares some test models to use across test assemblies. So my questions are:IncludeTestAssembly
work only for "root" test assemblies and not for referenced ones?Thanks.
The text was updated successfully, but these errors were encountered: