What is the proper way to configure googletest wit

2019-07-16 13:10发布

问题:

I am following the instructions located at https://github.com/google/googletest/blob/master/googletest/docs/XcodeGuide.md to set up googletest to work with Xcode. However, these instructions seem to be written for Xcode 3. Many things that this article mentions have changed in Xcode 4. What is the proper way to get google test to work with Xcode 4?

回答1:

I suggest using the open source xcode-googletest in order to integrate also with Xcode Test Framework (XCTest)



回答2:

  1. Follow the instructions located at https://github.com/google/googletest/blob/master/googletest/docs/XcodeGuide.md to build the gtest.framework package.
  2. Create a new command line tool target.
  3. Copy the contents of the main.cpp file in the googletest framework into your new main.cpp file for your target. Your main function will kick off the google test.
  4. Execute the new target when you want to run your unit tests.