Azure devops 在Azure DevOps中使用构建管道运行Google测试

Azure devops 在Azure DevOps中使用构建管道运行Google测试,azure-devops,visual-studio-2017,yaml,azure-pipelines,googletest,Azure Devops,Visual Studio 2017,Yaml,Azure Pipelines,Googletest,我在构建管道中运行gtest时遇到问题。我的解决方案可以很好地在Visual Studio 2017中构建和运行测试用例。在DevOps环境中,我使用.Net桌面设置,只需稍加修改。构建任务在管道中运行良好 我尝试使用默认的VSTest任务,但我不确定它是否适合运行从VSIDE使用VisualStudio项目创建的Google测试 构建pipline yml脚本 VST测试日志输出 是,VSTest任务将使用VSTest.Console.exe。它能够运行自定义测试适配器(如Google测试适配

我在构建管道中运行gtest时遇到问题。我的解决方案可以很好地在Visual Studio 2017中构建和运行测试用例。在DevOps环境中,我使用.Net桌面设置,只需稍加修改。构建任务在管道中运行良好

我尝试使用默认的VSTest任务,但我不确定它是否适合运行从VSIDE使用VisualStudio项目创建的Google测试

构建pipline yml脚本 VST测试日志输出
是,VSTest任务将使用
VSTest.Console.exe
。它能够运行自定义测试适配器(如Google测试适配器)

但是,在查看托管的VS2017 build agent的内置软件后,它并未列出。如果是这样,你可以使用

您可以下载GoogleTestAdapter作为VisualStudio扩展名,将其解压缩(将.vsix文件重命名为.zip),然后将整个解压缩文件夹放在构建代理计算机上的某个位置。然后,构建步骤必须指向该目录

当然,为了运行测试,您的项目还应该包括“googletest”NuGet包

如果您仍然无法使其正常工作,请通过Azure DevOps管道使用visual studio或命令行远程构建代理计算机并手动运行构建和测试。如果这是一个环境问题,这将缩小范围

# .NET Desktop

trigger:
- master

# Install build environment 
pool:
  vmImage: 'windows-latest'
  name: Hosted VS2017

variables:
  solution: '**/*.sln'
  buildPlatform: 'x86'
  buildConfiguration: 'Debug'

steps:

- task: NuGetCommand@2
  inputs:
    restoreSolution: '$(solution)'

# Build VS solutions including gtest project.   
- task: VSBuild@1
  inputs:
    solution: '$(solution)'
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'

# Run gTest, this task not working see log below.  
- task: VSTest@2
  inputs:
    platform: '$(buildPlatform)'
    configuration: '$(buildConfiguration)'
Running tests using vstest.console.exe runner.
======================================================
Test selector : Test assemblies
Test filter criteria : null
Search folder : d:\a\1\s
VisualStudio version selected for test execution : latest
Attempting to find vstest.console from a visual studio installation with version [16.0,17.0).
Attempting to find vstest.console from a visual studio build tools installation with version [16.0,17.0).
Attempting to find vstest.console from a visual studio installation with version [15.0,16.0).
Run in parallel : false
Run in isolation : false
Path to custom adapters : null
Other console options : null
Code coverage enabled : false
Diagnostics enabled : false
SystemVssConnection exists true
Run the tests locally using vstest.console.exe
========================================================
##[warning]No test assemblies found matching the pattern: **\*test*.dll,!**\*TestAdapter.dll,!**\obj\**.