GoogleTestAddin

GoogleTestAddin is an Add-In for Visual Studio 2010. It makes it easier to execute/debug googletest
functions by selecting them. You'll no longer have to set the command arguments of your test application.

The output of the googletest console application is redirected to the a additional Visual Studio output window.
The benefit here is, that if any test fails then the information about the failed test is written to the output where it
can be double clicked to jump to the source line.

How to install the Add-In on Visual Studio 2010

Place the two files GoogleTestAddIn.AddIn and GoogleTestAddin.dll into the following folder:

C:\Users\<Username>\Documents\Visual Studio 2010\Addins

 Start Visual Studio 2010 and the Add-In can be found listed under Tools -> Add-in Manager.          

How to install the Add-In on Visual Studio 2008

Place the two files GoogleTestAddIn.AddIn and GoogleTestAddin.dll into the following folder:

C:\Users\<Username>\Documents\Visual Studio 2008\Addins

 Start Visual Studio 2008 and the Add-In can be found listed under Tools -> Add-in Manager.   


 

The Add-In adds three buttons to the toolbar of Visual Studio 2008/10 and adds three items to the
code context menu of Visual Studio 2008/10. They are activated only when a C++ project is loaded.

 Buttons added by the Add-in

The function behind this three buttons/items is:

  1. Execute all test and redirect the output to the “GoggleTest” output pane in Visual Studio.
  2. Execute the selected test or test function and redirect the output to the “GoggleTest” output pane in Visual Studio.
  3. Debug the selected test or test function. At this mode the output is not redirected to the output pane.
 

How to use the Addin with Visual Studio 2008/10

In your test code you will use the following to define a test function:

TEST ( TestName, TestFunction )
{
     
      EXPECT_EQ( … );
     
}

Or

TEST_F ( CTestClass, TestFunction )
{
     
      EXPECT_EQ( … );
     
}

Now you can select which part of the tests should be  executed/debugged with the following selections:

 

TEST ( TestName, TestFunction )

Executes/Debug only the function TestFunction within the test TestName.
Calls the test application with the option --gtest_filter=TestName.TestFunction

TEST ( TestName, TestFunction )

Executes/Debug all functions within the test TestName.
Calls the test application with the option --gtest_filter=TestName.*

 

The following output is generated by the Add-in:

Output of the GoogleTest Add-in

Output with failed test:

Output of a failed test

Thats it.