Step by step instructions for getting cppunit up and running with Netbeans 7.2 on OS X 10.8 Mountain Lion

cppunitnetbeansnetbeans-7.2osx-mountain-lion

Can someone please provide step by step instructions for getting cppunit working on OS X 10.8 Mountain Lion? This includes any downloads needed and any configuration of Netbeans.

Currently, when I add a cppunit test, there is a warning on the Add Test dialog that says "cppunit library is not detected. Test compilation might fail." I've download both from Sourceforge and from svn cppunit and copied the files to /usr/local/include, but this does not make compilation errors go away.

What am I missing? The Google™ has been of no help with this issue.

Best Answer

I used Homebrew to install CppUnit on OS X 10.8 Mountain Lion. Unit tests then worked from within Netbeans without issue.

The process I followed was:

  1. Install the XCode Command Line Tools
    • Available in XCode preferences or Download as separate DMG
  2. Install Homebrew
    • See http://mxcl.github.com/homebrew/
    • ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
    • Following install instructions (brew doctor at the end for example)
  3. Use brew to install cppunit
    • brew install cppunit
  4. In Netbeans:
    • Create C++ project
    • Add a function to test
    • Right click cpp file, select "Create Test", choose CppUnit Test
    • Select function from list, follow prompts to create test
  5. Execute tests
    • Right click project, select Test (or crtl+F6)