如何使用运行设置从我的代码覆盖率中排除模块/dll?

问题描述

我正在拔头发试图让它发挥作用。我正在使用示例 .runsettings 文件 https://docs.microsoft.com/en-us/visualstudio/test/customizing-code-coverage-analysis?view=vs-2019

我正在跑步:

vstest.console.exe "**\bin***Test.dll" --settings:c:\source\CodeCoverage.runsettings --testcasefilter:Backend!=Database --diag:"c:\source\log.txt"

(我需要 --enablecodecoverage 吗?不管有没有它似乎都一样)

那么:

$TestResultsPath = resolve-path "c:\source\TestResults***.coverage" | Select -ExpandProperty Path
CodeCoverage.exe analyze /output:DynamicCodeCoverage.coveragexml "$TestResultsPath"

XML 包含名称中带有 Microsoft 的 DLL。 (在我看来他们也应该被排除在外)。

我已经添加了 XUnit 来排除,但仍然在 XML 中列出 XUnit,并使用报告生成器从它生成的报告中。

 <ModulePaths>
   <Include>
      <ModulePath>.*\.dll$</ModulePath>
      <ModulePath>.*\.exe$</ModulePath>
   </Include>
   <Exclude>
       <ModulePath>.*CPPUnitTestFramework.*</ModulePath>
       <ModulePath>.*XUnit.*</ModulePath>
   </Exclude>
 </ModulePaths>

XUnit dll 也包含在报告中。

我查看了日志,它显示了我添加了 XUnit 排除项的运行设置。

日志.txt

顺便说一句:我在 mcr.microsoft.com/dotnet/framework/sdk:4.8 windows 容器中运行它。

任何帮助表示赞赏。我希望根本看不到 Microsoft.SignalR.xx 或 XUnit.* dll。

编辑此文件和/或排除这些依赖项 dll 的正确方法是什么?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)