-
I want to exclude code decorated with To summarize what I see, a class decorated with Is this correct behavior? Steps to Reproduce:
Add
Execute test and code coverage from command line at solution root: Expected outcome:
Note: 100% is expected because Class2 isn't covered by any test and is expected to be excluded from coverage. This leaves only Class1, which is 100% covered by tests. Actual outcome:
Analysis Question: The coverage report appears to be based on the unfiltered XUnitTestProject1/coverage.json rather than the filtered XUnitTestProject1/TestResults//coverage.cobertura.xml file. Shouldn't this report factor in the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I see the difference now. Exclusions in runsettings.xml are applied to /TestResults output. For the console coverage report, exclusions are applied on the command line with To be clear: Exclusions in runsettings.xml affect /TestResults output. Exclusions on the command line (e.g. |
Beta Was this translation helpful? Give feedback.
I see the difference now. Exclusions in runsettings.xml are applied to /TestResults output. For the console coverage report, exclusions are applied on the command line with
/p:ExcludeByAttribute="GeneratedCodeAttribute"
.To be clear: Exclusions in runsettings.xml affect /TestResults output. Exclusions on the command line (e.g.
/p:ExcludeByAttribute=
) affect the MSBuild console coverage report. The two configurations are independent.