I love the sanity that GHUnit brings to running and debugging unit tests. The under-documented Xcode 3 mojo needed to configure SenTest unit test bundles for debugging throws a wet towel on the practice of test-driven Cocoa development.
The current GHUnit distribution runs all unit tests found in your app or framework. I did some work today to enable running a selected test cases and individual unit tests.
This works similarly to the SenTestingKit’s otest tool. You specify a unit test case and/or test name to run as an argument to the GHUnit test application.
In the Xcode’s executable panel for the test application, add arguments of the form:
-Test UserTests
-Test UserTests/testEmptyUserName
-Test All
When you run or debug the test app, only the specified test case or individual test will be executed. The argument -Test All will run all available unit test cases.
The patch file is here and works for Mac OS X. To apply the patch:
$ cd your-GHUnit-project-directory
$ patch -p1 < path-to-patch-file
I’ve submitted the patch to Gabriel, so maybe it’ll make it into a future release.
Tags: Cocoa, UnitTesting