4

So I was able to supply runsettings and that worked

dotnet test --filter "TestCategory != Ignore" --no-build --no-restore -v normal --collect "Code coverage" -s *.runsettingss

Which included this:

<ModulePaths>
 <Include>
    <ModulePath>.*\.dll$</ModulePath>
    <ModulePath>.*\.exe$</ModulePath>
  </Include>
  <Exclude>
     <ModulePath>.*\\[^\\]*UnitTests[^\\]*\.dll</ModulePath>
  </Exclude>
</ModulePaths>

But apparently we can also pass along this as arguments but for the life of me I can't figure out how to structure it.

My last attempt was:

dotnet test --filter "TestCategory != Ignore" --no-build --no-restore -v normal --collect "Code   coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.CodeCoverage.ModulePaths.Exclude.ModulePath=".*\\[^\\]*UnitTests[^\\]*\.dll"

But the above does not work ^ Using these for reference:

https://learn.microsoft.com/en-us/visualstudio/test/customizing-code-coverage-analysis?view=vs-2019 https://github.com/Microsoft/vstest-docs/blob/master/docs/RunSettingsArguments.md

Ofek
  • 325
  • 1
  • 2
  • 13
  • Did you ever figure it out? I know that you can use an attribute to exclude test classes but our project has a lot so I was hoping for an easier approach. – Justin Harris Dec 23 '21 at 22:54
  • I think there should be slashes in ModulePath node values. Maybe you want to use Source nodes for file paths? – Justin Harris Dec 24 '21 at 01:33

0 Answers0