UKTestHandler class documentation

Authors

Generated by builder

Copyright: (C) 2004 James Duncan Davidson, Michael Milvich, Mark Dalrymple, Nicolas Roard, Quentin Mathe

Software documentation for the UKTestHandler class

UKTestHandler : NSObject

Declared in:
UKTestHandler.h

@abstract 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.

Method summary

handler 

+ (UKTestHandler*) handler;

@taskunit Initialization

Returns the shared test handler.


delegate 

- (id) delegate;

@taskunit Controlling Test Result Reporting

Returns a delegate that can implement the same reporting methods than UKTestHandler.

By default, returns nil.

For more details, see -setDelegate: .


doesNotRaisesException: inFile: line: 

- (void) doesNotRaisesException: (NSException*)exception inFile: (const char*)filename line: (int)line;
Description forthcoming.

exceptionsReported 

- (int) exceptionsReported;

Returns the current number of exceptions caught by UKRunner and reported to the test handler.

See -reportException:inClass:hint: .


failInFile: line: 

- (void) failInFile: (const char*)filename line: (int)line;
Description forthcoming.

isQuiet 

- (BOOL) isQuiet;

Returns whether the handler should report just the test failures and uncaught exceptions, but nothing on test successes.

By default, returns NO.

-isQuiet is initialized to YES if the argument -q is present in the ukrun arguments.


passInFile: line: 

- (void) passInFile: (const char*)filename line: (int)line;

@taskunit Basic Test Assertions


raisesException: class: inFile: line: 

- (void) raisesException: (id)raisedObject class: (Class)expectedClass inFile: (const char*)filename line: (int)line;
Description forthcoming.

raisesException: inFile: line: 

- (void) raisesException: (NSException*)exception inFile: (const char*)filename line: (int)line;

@taskunit Exception Test Assertions


raisesException: named: inFile: line: 

- (void) raisesException: (NSException*)exception named: (NSString*)expected inFile: (const char*)filename line: (int)line;
Description forthcoming.

reportException: inClass: hint: 

- (void) reportException: (NSException*)exception inClass: (Class)testClass hint: (NSString*)hint;

Reports an uncaught exception and a hint that represents the context in which the exception was raised.

To indicate the context, three hints are supported:

errExceptionOnInit
inside -init on a test object
errExceptionOnRelease
inside -dealloc on a test object
a test method name
inside a test method

By default, forwards the message to the delegate if there is one, otherwise uses -reportWarning: to print the exception reason.


reportStatus: inFile: line: message: 

- (void) reportStatus: (BOOL)cond inFile: (const char*)filename line: (int)line message: (NSString*)msg;

If we have a delegate, then by all means use it. If we don't, then check to see if we have any errors which should be reported off to std out.


reportWarning: 

- (void) reportWarning: (NSString*)message;

Reports a warning message.

By default, forwards the message to the delegate if there is one, otherwise uses NSLog() to print the message.

This method is used by -reportStatus:inFile:line:message: and -reportException:inClass:hint: to report test failures and uncaught exceptions.


setDelegate: 

- (void) setDelegate: (id)aDelegate;

Sets a delegate that can implement the same reporting methods than UKTestHandler.

If the delegate implements a reporting method, it takes priority over UKTestHandler. As a result, what was previously reported by UKTestHandler is not going to be automatically logged in the console unless the delegate does it.


setQuiet: 

- (void) setQuiet: (BOOL)isQuiet;

Tells the handler to report just the test failures and uncaught exceptions, but nothing on test successes.


testFalse: inFile: line: 

- (void) testFalse: (BOOL)cond inFile: (const char*)filename line: (int)line;
Description forthcoming.

testFloat: equalTo: delta: inFile: line: 

- (void) testFloat: (float)a equalTo: (float)b delta: (float)delta inFile: (const char*)filename line: (int)line;
Description forthcoming.

testFloat: notEqualTo: delta: inFile: line: 

- (void) testFloat: (float)a notEqualTo: (float)b delta: (float)delta inFile: (const char*)filename line: (int)line;
Description forthcoming.

testInt: equalTo: inFile: line: 

- (void) testInt: (int)a equalTo: (int)b inFile: (const char*)filename line: (int)line;

@taskunit Number Primitive Test Assertions


testInt: notEqualTo: inFile: line: 

- (void) testInt: (int)a notEqualTo: (int)b inFile: (const char*)filename line: (int)line;
Description forthcoming.

testNil: inFile: line: 

- (void) testNil: (void*)ref inFile: (const char*)filename line: (int)line;
Description forthcoming.

testNotNil: inFile: line: 

- (void) testNotNil: (void*)ref inFile: (const char*)filename line: (int)line;
Description forthcoming.

testObject: equalTo: inFile: line: 

- (void) testObject: (id)a equalTo: (id)b inFile: (const char*)filename line: (int)line;
Description forthcoming.

testObject: kindOf: inFile: line: 

- (void) testObject: (id)a kindOf: (id)b inFile: (const char*)filename line: (int)line;

@taskunit Object Test Assertions


testObject: notEqualTo: inFile: line: 

- (void) testObject: (id)a notEqualTo: (id)b inFile: (const char*)filename line: (int)line;
Description forthcoming.

testObject: notSameAs: inFile: line: 

- (void) testObject: (id)a notSameAs: (id)b inFile: (const char*)filename line: (int)line;
Description forthcoming.

testObject: sameAs: inFile: line: 

- (void) testObject: (id)a sameAs: (id)b inFile: (const char*)filename line: (int)line;
Description forthcoming.

testString: contains: inFile: line: 

- (void) testString: (NSString*)a contains: (NSString*)b inFile: (const char*)filename line: (int)line;
Description forthcoming.

testString: doesNotContain: inFile: line: 

- (void) testString: (NSString*)a doesNotContain: (NSString*)b inFile: (const char*)filename line: (int)line;
Description forthcoming.

testString: equalTo: inFile: line: 

- (void) testString: (NSString*)a equalTo: (NSString*)b inFile: (const char*)filename line: (int)line;

@taskunit String Test Assertions


testString: notEqualTo: inFile: line: 

- (void) testString: (NSString*)a notEqualTo: (NSString*)b inFile: (const char*)filename line: (int)line;
Description forthcoming.

testTrue: inFile: line: 

- (void) testTrue: (BOOL)cond inFile: (const char*)filename line: (int)line;

@taskunit Primitive Test Assertions


testsFailed 

- (int) testsFailed;

Returns the current number of test failures.

See -reportStatus:inFile:line:message: .


testsPassed 

- (int) testsPassed;

@taskunit Test Results

Returns the current number of test successes.

See -reportStatus:inFile:line:message: .