Skip to content
👨🏻‍🔬 Unit test framework for Objective-C
Objective-C C Roff Shell Makefile
Branch: master
Clone or download
Pull request Compare This branch is 1 commit behind mulle-nat:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
Sample Projects


based on UnitKit 1.1 with several fixes and
UnitKit is a unit test framework for Objective-C with some test support for C
as well.

The documentation for UnitKit is delivered as part of the distribution as the Manual.pdf file. It should contain everything you need to know to get started with UnitKit as well as serve as a resource guide.


Installing UnitKit is easy enough. Simply double click the UnitKit.pkg file that is part of the distribution and following the instructions. This will install files in the following locations:

	/Library/Application Support/Apple/Developer Tools

Unlike earlier versions of UnitKit, this package should not glom symlinked directories (for example, if you symlink /usr/local to some other location).


To build under Mac OS X, open up the UnitKit.xcode project and build away. Or, you can build UnitKit into its final deployment location using the following:

	$ sudo xcodebuild install


UnitKit doesn't come precompiled for GNUstep (a free software implementation of the OpenStep specifications available at To build:

	$ cd "Source/Framework Source"
	$ make
	$ make install (possibly using sudo)
	$ cd "../Tool Source"
	$ make
	$ make install (possibly using sudo)

I've put the start of a GNUMakefile at the top level, but it's just a guess. It needs to be verified, but hopefully will result in:

	$ make
	$ sudo make install


(This will be migrated into the Manual shortly)

In order to use UnitKit with GNUstep, you'll need to compile your sources as a bundle. Here is a GNUmakefile example:

    include $(GNUSTEP_MAKEFILES)/common.make

    BUNDLE_NAME = Test
    Test_OBJC_FILES= # your sources and test classes...
    Test_OBJC_LIBS= -lUnitKit

    include $(GNUSTEP_MAKEFILES)/bundle.make

Then, after building your code, just type:

    ukrun Test.bundle

As ukrun executes, it'll will print out a list of the tests and their status.


1.4 -> 1.5

* testTrue testFalse now use int instead of BOOL as a condition, which makes no
  difference to user tests.

* Rewrote test macros for plain C-compatibility

* added unit_c_kit and unit_objc_kit as a very simple testing facility in plain
  C. Test can be run in their own process, so assert() and abort() count as test

* upgraded int checks to long long and float checks to double. Should be
  backwards compatible and make things better f.e. when testing against

* new UKSetQuiet() macro to turn off temporarily the logging of successful tests
  useful when generating a lot of tests in a loop.

   old = UKSetQuiet( 1);
   UKSetQuiet( old);

1.3.1 -> 1.4

* Removed use of isEqualTo:, replaced with isEqual:. This is a change that _should_ make no difference, but in fact could break some stuff. isEqualTo: is not defined in the NSObject protocol and its use has been erroneous.

* Added -e switch to ukrun so unexpected exceptions terminate the test. It's my preference.

* Started a manpage for ukrun with the help of mandrake. (

* There is a weird Xcode 3 problem with "skip install" in Install Debug. Therefore it is now by hand turned off in the target configurartion.

* Substituted some more @throw/@catch with NS_DURING. On runtimes, where @throw exists NS_DURING will be a macro for @throw anway. UKRaisesExceptionClass only works for apples OBJC2 it seems.

* Renamed doesNotRaisesException to doesNotRaiseException, but the old method still works.

1.3 -> 1.3.1

* Changed compilation detection code for runtimes.

* Renamed "Test Source" folder to "TestSource", to make it easier for make.

* Rewrote somewhat suspicious CFRunLoop code. New code passes one test more consistently. There is a fallback, if CFRunLoop is not available.

* Changed the way the project is linked together for future goodness.

* Changed GNUmakefiles, so that UnitKit has a fighting chance to be buildable on GNUSTEP. It compiles but the framework isn't properly installed.

1.2.1 -> 1.3

* Removed "same difference" code with NS_DURING vs @catch. Removed RELEASENOTES.txt and put them in README.txt again (where the other CHANGES are)

* Added option to specify classes to test. Invoke with -test <classname>.

* Added UKPointersEqual and UKPointersNotEqual

1.2 -> 1.2.1

* Added a configuration Install-10.5+ and some code, so that 64bit also works. Made it a fat file with ppc support also.

1.1 -> 1.2

* Updated the Xcode Integration files.

* Unconfused the Xcode settings in the project and the targets. Changed the targets to "Install", "Install Debug", "Debug". Both "Install" targets will now directly build into "/Library/Frameworks". But you need "Install" for the Xcode Integration files.

* Removed the precompiled Prefix header.

* Changed import headers sequencing.

* You don't have to link against Foundation.framework anymore but just against UnitKit.framework for your tests. Also don't import <Foundation/Foundation.h> but just <UnitKit/UnitKit.h>. This will be useful in the years to come :)

* Removed dependencies on Carbon and AppKit.

1.0.1 -> 1.1

* Test classes and test methods are now executed in alphabetical order. This allows for easy lookup of test results in the test output. As well, it allows for testing of side effects on outside sources. Keep in mind that each test is executed on a fresh test class instance. This means you won't be able to keep an instance method reference to an outside source.

* Test methods are now run within the scope of a run loop. This means that you can test asynchronous callback functionality that relies on a run loop and place UK test assertions in notification callback methods and delegates. However, there are two things to keep in mind: 1) if there isn't anything queued on the run loop when your test method returns, your test class instance will immediately destroyed; and 2) though run loops aren't as dangerous to play with as threads, you can still create some interesting situations. Caveat programmer.

* Changed uncaught exception handler to also report the human readable reason for the exception�

* Changed [UKRunnner run] to [UKRunner runTests]. Apparently GNUstep barfs on the "run" method declaration.

* Modified [UKRunner runTests] to check for Mac OS X 10.3 and if so, use the new exception syntax, else use the old NS_DURING style macros.

* Modified UKTestClassesFromBundle to check for GNUstep and adjust its code for for getting test class names from bundles

* Modified UKTestMethodNamesFromClass to check for GNUstep and adjust its code for getting test methods from classes

* Changed the UnitKit bundle target template to only depend on the Foundation.framework (and not AppKit). You still have to add Foundation as a framework to the project, but this fixes a bug in some cross-development situtations.

1.0 -> 1.0.1

* David Steinbrunner contributed multiple fixes to the documentation and the source code. Mark Dalrymple contributed quiet mode and fixed a bug with multiple test bundles not being executed correctly.


Comments, questions, rants, and raves are always welcome. Please consider joining the mailing list. To subscribe, send email to:

You can also mail me personally, but I can't guarantee a speedy response.


UnitKit is licensed under the Apache License 2.0. You may not use UnitKit except in compliance with the License. You can obtain a copy of the license at:

The use of the Apache license does not indicate that this project is affiliated with, or endorsed by, the Apache Software Foundation.

James Duncan Davidson


You can’t perform that action at this time.