Reputation: 8763
I'm trying to run google test using vstest.console.exe.
I'm wondering if there is a way to debug why vstest.console.exe is not finding google tests.
Here is some output running locally:
C:\Development\Source\Bentley.Reliability\oq.framework\Tests\Infrastructure.Native.Tests\bin\x64\Debug>vstest.console.exe Infrastructure.Native.Tests.exe /TestAdapterPath:c:\packages\GoogleTestAdapter.0.18.0\build\_common -- RunConfiguration.TreatNoTestsAsError=true /Platform:x64 /Configuration:Debug
Microsoft (R) Test Execution Command Line Tool Version 17.3.0-preview-20220626-01 (x64)
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
No test is available in C:\Development\Source\Bentley.Reliability\oq.framework\Tests\Infrastructure.Native.Tests\bin\x64\Debug\Infrastructure.Native.Tests.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
C:\Development\Source\Bentley.Reliability\oq.framework\Tests\Infrastructure.Native.Tests\bin\x64\Debug>Infrastructure.Native.Tests.exe --gtest_list_tests
Running main() from C:\Development\Source\Bentley.Reliability\packages\gmock.1.11.0\lib\native\src\gtest\src\gtest_main.cc
RestoreDatabaseTests.
RestoreDatabaseTest
CreateSnapshotTest
RestoreDatabaseBlankServerNameTest
RestoreDatabaseBlankDatabaseNameTest
RestoreDatabaseBlankUserNameTest
RestoreDatabaseIncorrectPasswordTest
TestExceptions.
InvalidActivityExceptionTest
InvalidConfigurationExceptionTest
InvalidSessionExceptionTest
PlatformNotSupportedExceptionTest
OQGenericObjectTest
TestDynamicCast_IncorrectExceptionType_Returns_Null
TestConfigurationProxy.
TestBasics
TestUnmanagedSettings
TestKernelExecutionContextThreadStorage.
TestKernelExecutionContextThreadLocalStorage
TestSqlUomListLoader.
TestLoadUomsFromDatabase_Success
TestMockAdapter_LoadUomsFromDatabase_Success
TestMockAdapter_LoadUomsFromDatabase_FetchFails
TestMockAdapter_LoadUomsFromDatabase_FetchFails_ValidateMessage
TestUOMListInterop.
CreateUOMList_throws_on_null_loggingProxy
CreateUOMList_throws_on_null_sqlAdapter
oUOM_GetUOMS_asserts_on_null_kernelExecutionContext
oUOM_GetUOMS_asserts_on_null_uomlist
oUOM_GetUOMS_no_asserts_when_list_defined
MockConfigurationTests.
TestGetValueFromFakeCollection
TestGetValueFromEnvironment
TestGetValueOrderPrecidence
TestRemovingFakeValue
Upvotes: 0
Views: 665
Reputation: 8763
I will put how I got it working in DevOps yaml.
A similar approach could be used to the GoogleTestAdapter locally and have a known path to the test adapter.
e.g. $(Build.Repository.LocalPath)\GoogleTestAdapterPackage\GoogleTestAdapter\build_common - but replace $(Build.Repository.LocalPath) with your root folder.
One option is to run nuget install and exclude version ( so you don't get 3.17 etc in the path )
You could also run nuget install as a pre-build event.
- task: NuGetCommand@2
displayName: 'Nuget install GoogleTestAdapter'
inputs:
command: 'custom'
arguments: 'install GoogleTestAdapter -ExcludeVersion -OutputDirectory $(Build.Repository.LocalPath)\GoogleTestAdapterPackage'
- powershell: 'Get-ChildItem -Path $(Build.Repository.LocalPath)\GoogleTestAdapterPackage\GoogleTestAdapter\build\_common\'
displayName: 'List GoogleTestAdapter files for debugging purposes'
Then you can reference the path using something similar to pathtoCustomTestAdapters
- task: VSTest@2
displayName: 'Run ReliabilityUpdateService.IntegrationTests.exe'
inputs:
testAssemblyVer2: ReliabilityUpdateService.IntegrationTests.exe
searchFolder: $(rootFolder)\tests\ReliabilityUpdateService.IntegrationTests\bin\$(buildPlatform)\$(buildConfiguration)
testRunTitle: ReliabilityUpdateService.IntegrationTests.exe
platform: "$(buildPlatform)"
configuration: "$(buildConfiguration)"
pathtoCustomTestAdapters: '$(Build.Repository.LocalPath)\GoogleTestAdapterPackage\GoogleTestAdapter\build\_common'
Upvotes: 1