csoltenborn / GoogleTestAdapter

Visual studio extension that adds support for the C++ testing framework Google Test.
Other
143 stars 100 forks source link

Doesn't work in VS2022 #340

Closed Raffaello closed 2 years ago

Raffaello commented 2 years ago

Is VS2022 supported yet for this extensions?

Running the GTest Suite from Test Explorer generates this exception for each single discovered test:

========== Starting test run ==========
Test Adapter for Google Test: Test execution starting...
Running 2 tests...
ERROR: Exception while running tests: System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at GoogleTestAdapter.TestAdapter.Settings.TestPropertySettingsContainer.EnsureTestPropertiesMap()
   at GoogleTestAdapter.TestAdapter.Settings.TestPropertySettingsContainer.TryGetSettings(String testName, ITestPropertySettings& settings)
   at GoogleTestAdapter.Runners.SequentialTestRunner.<>c__DisplayClass9_2.<RunTests>b__0()
   at GoogleTestAdapter.Settings.SettingsWrapper.ExecuteWithSettingsForExecutable(String executable, Action action, ILogger logger)
   at GoogleTestAdapter.Runners.SequentialTestRunner.RunTests(IEnumerable`1 testCasesToRun, String baseDir, String workingDir, String userParameters, Boolean isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher, IProcessExecutor executor)
   at GoogleTestAdapter.Runners.PreparingTestRunner.RunTests(IEnumerable`1 testCasesToRun, String baseDir, String workingDir, String userParameters, Boolean isBeingDebugged, IDebuggedProcessLauncher debuggedLauncher, IProcessExecutor executor)
Test Adapter for Google Test: Test execution starting...

The Test suite is working running CTest and it was working with Test Explorer in VS2019.


P.S.

The Project is set up with CMake and with a macro to create the tests, in each single test create is using gtest_discover_tests(${TEST_EXE}) for discovery

But i don't think there is nothing related to the build-chains underneeth, it looks like more a VisualStuiod -> Test Explorer integration that is slightly changed from VS2019 and then throw the exception.

csoltenborn commented 2 years ago

VS2022 is not supported yet - not sure whether I'm going to find the time to do that, I must admit... See #333 .