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:
- Follow the instructions located at https://github.com/google/googletest/blob/master/googletest/docs/XcodeGuide.md to build the gtest.framework package.
- Create a new command line tool target.
- 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.
- Execute the new target when you want to run your unit tests.