googletest Google C++ Testing Framework

Getting Started

Using Microsoft Visual Studio _and_ do test driven development is not a fundamental contradiction. There are different tools freely available on the web; we choose googletest:

You have to download the current source code package, configure and generate with cmake a Visual Studio solution. Pay attention to enable BUILD_SHARED_LIBS in cmake. After having built a Visual Studio solution build the Debug and Release configuration.

In the project where you will use googletest, three additions in the project settings have to be done:

  1. Additional Include Directories need to know where the ‘include’ folder of gtest is located.
  2. Additional Library Directories need to know where the Debug resp. Release folder with the libs is located.
  3. Additional dependencies have to be extended by gtest.lib and gtest_main.lib

In order to be able to run the tests you have to init googletest. To run all the tests the macro RUN_ALL_TESTS() is defined.

  //just init googletest
  testing::InitGoogleTest(&argc, argv);
  //run all the tests!

For more information see the documentation of googletest:

There is also a Visual Studio 2010 addin for googletest:

A short documentation for the addin can be found here: