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: http://code.google.com/p/googletest/
You have to download the current source code package, configure and generate with cmake http://www.cmake.org/ 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:
-
Additional Include Directories need to know where the ‘include’ folder of gtest is located.
-
Additional Library Directories need to know where the Debug resp. Release folder with the libs is located.
-
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! RUN_ALL_TESTS();
For more information see the documentation of googletest:http://code.google.com/p/googletest/wiki/V1_6_Documentation
There is also a Visual Studio 2010 addin for googletest: http://googletestaddin.codeplex.com/releases/view/80395
A short documentation for the addin can be found here: http://googletestaddin.codeplex.com/documentation