I’ve always wondered why XCode doesn’t have a unit testing GUI like other IDEs, or why the SenTesting framework has to be such a pain to setup, with all its RunScript build phases, shell scripts, octest bundle insanity. After using the GTMTestCase for the iPhone (since SenTesting isn’t supported on the iPhone SDK) I decided to try to re-purpose some of the GTM Unit Testing code into a standalone testing framework and GUI that I could use on both my Mac OS X and iPhone projects.
GHUnit (pronounced ˈgü-ˈnit, I guess?), hosted at gabriel/gh-unit, is meant to be installed as a framework, and run as an application in a separate Test target. The idea being that you can run and crash into the XCode debugger directly and utilize all the debugging techniques that you normally use. The test GUI should allow you to see test failures more clearly, view timings / stats and not have to go fishing for the build console window. And an automated way to view stack traces.
Details on how to use the framework are included in the README.

GHUnit Test GUI for Mac OS X App

Unit Test GUI for iPhone App
For the iPhone side, I included a similar GUI that runs the tests in the simulator.
GHUnit can be used as a standalone test framework (by subclassing GHTestCase), or with your existing SenTestCase tests or GTMTestCase tests.
So far its pretty basic, but I am using it on a couple projects and its been helping my development a bunch and letting me to write tests as I go without completely destroying my workflow or sanity.
Any feedback is appreciated and let me know if you have any problems with the install/embed instructions or in general. Also thanks to the GTM peeps, on which much of this is based.
Maybe the next step is an XCode plugin?



Looks very nice. From the nice standalone test output UI can we/could we rerun individual tests?
I’ve been thinking about whether its possible to use the Fix & Continue, to edit a test and re-run without having to quit and re-compile? (Am dreaming about some crazy autotest mode.) But I think initially, a quick way to run or re-run a single test case or method would totally be useful.
BTW, started a google group @ http://groups.google.com/group/ghunit
Just noticed the GHUnit.framework headers were missing from the 0.2.6 build. Fixed in 0.2.7.
Thanks for the framework!
I wrote a review of three iPhone unit testing frameworks: OCUnit, GTM iPhone Unit Test, and GHUnit. Out of all of them I liked GHUnit the most! There are a few GUI issues, but that’s something that can be fixed. Details at the bottom of the post: http://paulsolt.com/2010/11/iphone-unit-testing-explained-part-1/
I’m writing a series of posts on iPhone unit testing and will be continuing to feature GHUnit.
Thanks for this framework. I spent hours trying to get unit testing within Xcode working to no avail. With this framework, it took about an hour to figure out what to do and then I was off and running. Thank!
Hello Gabe, Any updates on segment fault in 10.6?? It would be great if you provide a fix for it.
I heard reports of it not segfaulting in Lion…. But otherwise I am still baffled..