【发布时间】:2020-04-29 22:57:55
【问题描述】:
我的解决方案中有一个 .net 框架项目和一个测试项目,当我运行测试时,代码覆盖率结果显示合理。但我们使用 azuredevops 管道运行测试并获得代码覆盖率结果,这是不同的来自本地结果,结果板上显示了一些额外的dll。
我使用了一些假dll,这些dll似乎来自假dll。
【问题讨论】:
标签: unit-testing azure-devops microsoft-fakes
我的解决方案中有一个 .net 框架项目和一个测试项目,当我运行测试时,代码覆盖率结果显示合理。但我们使用 azuredevops 管道运行测试并获得代码覆盖率结果,这是不同的来自本地结果,结果板上显示了一些额外的dll。
我使用了一些假dll,这些dll似乎来自假dll。
【问题讨论】:
标签: unit-testing azure-devops microsoft-fakes
看来我应该在管道中指定运行设置文件和配置包含和排除,问题将得到解决。
<Configuration>
<CodeCoverage>
<!-- Match assembly file paths: -->
<ModulePaths>
<Include>
<ModulePath>.*FunctionApp*.dll</ModulePath>
<!--<ModulePath>.*\.exe$</ModulePath>-->
</Include>
<Exclude>
<ModulePath>.*AutoGenerated.dll</ModulePath>
<ModulePath>.*Tests.dll</ModulePath>
</Exclude>
</ModulePaths>
<!-- We recommend you do not change the following values: -->
<UseVerifiableInstrumentation>True</UseVerifiableInstrumentation>
<AllowLowIntegrityProcesses>True</AllowLowIntegrityProcesses>
<CollectFromChildProcesses>True</CollectFromChildProcesses>
<CollectAspDotNet>False</CollectAspDotNet>
</CodeCoverage>
</Configuration>
在管道中,指定设置
steps:
- task: VSTest@2
displayName: 'VsTest - testAssemblies'
inputs:
runSettingsFile: src/...../CodeCoverage.runsettings
【讨论】: