SkillAgentSearch skills...

GoogleTestAdapter

Visual studio extension that adds support for the C++ testing framework Google Test.

Install / Use

/learn @csoltenborn/GoogleTestAdapter
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Build status Code coverage Visual Studio Marketplace downloads NuGet downloads

Looking for a Maintainer

As you might have noticed, this project is not maintained any more (I have moved to different technologies and are not even working as a developer any more). Since it still has a few features which the MS clone (which is still developed and delivered with Visual Studio) does not support, there still seems to be some interest in the project. Thus, if anybody wants to take over this project, please get in touch - I will certainly try to get you up and running!

Google Test Adapter

Google Test Adapter (GTA) is a Visual Studio extension providing test discovery and execution of C++ tests written with the Google Test framework.

Screenshot of Test Explorer

Features

History

Usage

Installation

Download from Visual Studio Marketplace Download from NuGet Download from GitHub

Google Test Adapter can be installed in three ways:

  • Install through the Visual Studio Marketplace at Tools/Extensions and Updates - search for Google Test Adapter.
  • Download and launch the VSIX installer from either the Visual Studio Marketplace or GitHub
  • Add a NuGet dependency to the Google test adapter nuget package to your Google Test projects. Note, however, that Visual Studio integration is limited this way: VS can discover and run tests, but no debugging, options or toolbar will be available; configuration is only possible through solution config files (see below).

After restarting VS, your tests will be displayed in the Test Explorer at build completion time. If no or not all tests show up, have a look at the trouble shooting section.

Note that due to Microsoft requiring VS extensions to support asynchronous package loading, the last version of Google Test Adapter which supports Visual Studio 2012 is 0.14.4.

<a name="gta_configuration"></a>Configuration

GTA provides different ways of configuration:

  • <a name="global_settings"></a>The Google Test Adapter section of Visual Studio's Tools/Options (not available if installed via NuGet). These options are referred to as global options in the following.
  • <a name="toolbar"></a>The GTA toolbar (not available if installed via NuGet). The most important runtime options (i.e., Parallel test execution, Break on failure, Catch exceptions, and Print test output) can also be set via a toolbar; this is equivalent to setting the according options via Tools/Options/Google Test Adapter.
  • <a name="solution_settings"></a>Solution settings files (not available if run via VsTest.Console.exe). They are provided by means of an XML configuration file; this allows sharing of settings via source control. The configuration file must be placed in the same folder as the solution's .sln file, and must have the same name as that file, but with extension .gta.runsettings. E.g., if the solution file's name is Foo.sln, the settings file must be named Foo.gta.runsettings.
  • Visual Studio user settings files. VS allows for the selection of test settings files via the Test/Test Settings menu, and to pass such settings files to VsTest.Console.exe via the /Settings parameter.
  • Environment variable GTA_FALLBACK_SETTINGS. The settings file referred to from that environment variable will be used only if GTA fails to receive settings from the VS test framework; currently, this is only known to happen when running GTA through VsTest.Console.exe on VS 2017 V15.5 and later (see #184).

The format of solution and user settings files is the same: a <GoogleTestAdapterSettings> node contains the solution settings and the (possibly empty) set of project settings and is itself contained in a <RunSettings> node (which in the case of user settings files might contain additional, e.g. VS specific settings). In contrast to solution settings, each set of project settings additionally has a regular expression to be evaluated at test discovery and execution time.

The final settings to be used are computed by merging the available settings, vaguely following Visual Studio's approach of configuration inheritance. Merging is done in two stages:

  1. The available global, solution file, and user file settings are merged into solution settings and a set of project settings. This is done in increasing priority, i.e., solution file settings override global settings, and user file settings override solution settings. Project settings of solution and user settings files are merged if they share the exact same regular expression.
  2. At test discovery and execution time, each test executable's full path is matched against the project settings' regular expressions; the first matching project settings are used for the particular test executable. If no project settings are found, the solution settings are used.

Overall, given a test executable mytests.exe, the following settings apply to that executable in decreasing priority:

  1. Project settings of a user settings file, the regular expression of which matches the full path of mytests.exe.
  2. Project settings of a solution settings file, the regular expression of which matches the full path of mytests.exe.
  3. Solution settings of a user settings file.
  4. Solution settings of a solution settings file.
  5. Global settings.

Note that due to the overriding hierarchy described above, you probably want to provide only a subset of

View on GitHub
GitHub Stars147
CategoryDevelopment
Updated2mo ago
Forks108

Languages

C#

Security Score

85/100

Audited on Jan 12, 2026

No findings