c++visual-studiogoogletest

Cannot open source file gtest/gtest.h


I have installed Google Test Adapter in visual studio 2015 and was expecting it to automatically set include paths link to the necessary libraries. But it seems that there is some other step I am missing because I get a "cannot include gtest/gtest.h" error. If I have to manually do all this even after installing the extension, then what's the point of this extension? or am I missing something?


Solution

  • See the feature description on 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."

    Google Test (gtest) tests are compiled to an executable that supports different options to filter the to be executed test cases and to select the output format (see "Writing the main() Function"). The Google Test Adapter can be used to execute one of this executables.

    So you need to download the gtest framework and configure the include path for the solution/the project correctly, compile the tests to an executable and use the Google Test Adapter to discover and execute the tests. (To configure the Google Test Adapter go to Debug->Options->Google Test Adapter.)