TestExplorer: Tests cannot be executed from TestExplorer because of the different output directories

Michael Brunner 40 Reputation points
2023-09-25T15:12:38.08+00:00

Setup:

  • Windows 11
  • Visual Studio 2022
  • C++ 20

I work in a large project with over 70 sub-projects. The output directories of the individual DLL's are different.

Now when I want to run UnitTests, the required DLL's are not found and I get the error Failed to set up the execution context to run the test.

When i start the test DLL via

call "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars64.bat"

set PATH=%PATH%;C:\some\thing\aLib;C:\some\thing\\else\aOtherLib; .....
vstest.console.exe C:\path\to\my\TestLibrary.dll

then the test execution is fine, but not visible in TestExplorer.

Can someone help how i could make the setup to run my tests from Test Explorer ? Is it possible to set the environment variables in the test explorer?

Thanks for ur help!

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,618 questions
Visual Studio Testing
Visual Studio Testing
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Testing: The act or process of applying tests as a means of analysis or diagnosis.
336 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Brunner 40 Reputation points
    2023-09-26T12:45:22.83+00:00

    Hi,

    The issue was caused due to the missing 3rd-party DLL's in the path envionment variable.

    Thanks

    0 comments No comments