C++ unit testing with AppCode and GoogleTest

AppCode started to support Google Test since 2.5 EAP. Steps to get it work:

  1. Get Google Test
  2. Open {gtest_path}/xcode/gtest.xcodeproj and build gtest.framework
  3. Create a “Command Line Tool” project or target
  4. Add gtest.framework to project and the new target
  5. Set Up the Executable Run Environment. 3 options:
  6. Make sure your project and google test use the same C++ standard library
  7. In AppCode, Run/Edit Configurations, Add new Google Test Configurations Add Run Configuration
  8. Set target to the created “Command Line Tool”
  9. Run google test from main.cpp
    #include <gtest/gtest.h>
    int main(int argc, char **argv) {
     ::testing::InitGoogleTest(&argc, argv);
     return RUN_ALL_TESTS();
    }
    
    Add your tests and happy testing!
    Google Test Support in AppCode