我正在拔头发试图让它发挥作用。我正在使用示例 .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 的正确方法是什么?