在Azure Dev Ops中对.net Core应用程序进行单元测试时的问题

时间:2019-07-15 10:36:45

标签: unit-testing azure-devops asp.net-core-2.2 vs-unit-testing-framework

我有一个.net core 2.2项目,其中一些单元测试使用Visual Studio Testing测试类库项目

Visual Studio测试-YAML

steps:
  - task: VSTest@2
  displayName: 'VsTest - testAssemblies'
  inputs:
    testAssemblyVer2: |
      **\*test*.dll
     !**\*TestAdapter.dll
     !**\obj\**
     **\$(BuildConfiguration)\*\*unittests.dll
     **\$(BuildConfiguration)\*\*test*.dll
     !**\*Microsoft.VisualStudio.TestPlatform*
  vstestLocationMethod: location
  vstestLocation: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\Extensions\TestPlatform\'
  codeCoverageEnabled: true
  otherConsoleOptions: '/Framework:.NETCoreApp,Version=v2.2 /logger:console;verbosity="normal"'
  platform: '$(buildPlatform)'
  configuration: '$(buildConfiguration)'
  timeoutInMinutes: 1

错误消息

[警告]未找到与模式匹配的测试程序集:

* test * .dll,! * TestAdapter.dll,! \ obj **, \ Release ** unittests.dll, \ Release ** test * .dll,! * Microsoft.VisualStudio.TestPlatform *。

谁能确定需要做些什么才能使其正常工作?

我已经尝试了多种不同的选择

1 个答案:

答案 0 :(得分:1)

我相信您需要指出项目本身;不是输出DLL的。

因此您的模式需要看起来像这样:**/*[Tt]ests/*.csproj

这将导致DEV Ops加载其项目名称中带有Tests的所有项目

enter image description here