API Overview
Misc

- UKRunner
UKTestRunner runs the test suite(s) and reports the results.
Usually you are not expected to use UKRunner directly to run a test suite, but to use ukrun that will ask UKRunner to do it with +runTests .
Test Bundle Loading and Argument Parsing
UKRunner will parse arguments from the command-line bound to -[UKTestHandler isQuiet] and -[UKRunner classRegex] , and can load one or multiple test bundles, either passed among the arguments or to -runTestsInBundle:principalClass: (if you use the API directly instead of ukrun ).
Collecting Test Classes
For each test bundle, UKRunner collects test classes marked with UKTest. If you don't use a test bundle, test classes can be passed explicitly with -runTestsWithClassNames:principalClass:.
If -classRegex is set, not all the test classes passed to UKRunner API will be run, but just the subset whose name matches the regex.
Executing Test Methods
A test method is a method prefixed with test e.g. -testSometing .
For each class marked with UKTest and each test method in this class (this also includes all the inherited test methods up to the superclass that conforms to UKTest), UKRunner will create an instance and invoke the test method, then release the instance, then create a new instance for the next test method, and so on. For details, see -runTests:onInstance:ofClass: .
UKRunner also supports test class methods e.g. +testSomething .
The test methods are executed in their alphabetical order.
Notifications
Each time methods -runTestsWithClassNames:principalClass: and -runTestsInBundle:principalClass: are invoked, the runner calls +willRunTestSuite and +didRunTestSuite on the principal class, and runs the test suite between them.
For common use cases, see +[NSObject willRunTestSuite] .
- NSObject (UKPrincipalClassNotifications)
Test suite related notifications.
These delegate methods can be implemented in the principal class. See the Notifications section in UKRunner class description.
- UKTestHandler
UKTestHandler implements the test assertions built into UnitKit and track the test results
For each test assertion invoked on the test handler, the handler collects the result and reports it or not based on the reporting settings.
At any time, you can query the current test results using -testsPassed , -testsFailed and -exceptionsReported , for all the test assertions invoked since the test handler has been created.
A single test handler exists for all UKRunner instances. For multiple run test requests against UKRunner instances, all test results are reported together.