azuredevops测试代码覆盖率结果问题

时间:2020-01-13 08:42:14

标签: unit-testing azure-devops microsoft-fakes

我的解决方案中有一个.net框架项目和一个测试项目,运行测试时,代码覆盖率结果显示合理。但是我们使用azuredevops管道运行测试并获得代码覆盖率结果,这是不同的来自本地资源,结果板上会显示一些额外的dll。

enter image description here

我使用了一些伪造的dll,看来这些dll来自伪造的dll。

1 个答案:

答案 0 :(得分:0)

似乎我应该在管道中指定运行设置文件和config include和exclude,问题将得到解决。

 <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