Inherits from NSObject
Declared in GHTesting.h
GHTesting.m

Overview

Utility test for loading and running tests.

Much of this is borrowed from GTM/UnitTesting.

Tasks

Class Methods

descriptionForException:

Format test exception.

+ (NSString *)descriptionForException:(NSException *)exception

Parameters

exception

Exception

Return Value

Description

Declared In

GHTesting.h

exceptionFilenameForTest:

Filename for cause of test exception.

+ (NSString *)exceptionFilenameForTest:(id<GHTest>)test

Parameters

test

Test

Return Value

Filename

Declared In

GHTesting.h

exceptionLineNumberForTest:

Line number for cause of test exception.

+ (NSInteger)exceptionLineNumberForTest:(id<GHTest>)test

Parameters

test

Test

Return Value

Line number

Declared In

GHTesting.h

runTestOrRaiseWithTarget:selector:exception:interval:

Same as normal runTest without catching exceptions.

+ (BOOL)runTestOrRaiseWithTarget:(id)target selector:(SEL)selector exception:(NSException **)exception interval:(NSTimeInterval *)interval

Parameters

target

Target

selector

Selector

exception

Exception, if set, is retained and should be released by the caller.

interval

Time to run the test

Declared In

GHTesting.h

runTestWithTarget:selector:exception:interval:reraiseExceptions:

Run test.

+ (BOOL)runTestWithTarget:(id)target selector:(SEL)selector exception:(NSException **)exception interval:(NSTimeInterval *)interval reraiseExceptions:(BOOL)reraiseExceptions

Parameters

target

Target

selector

Selector

exception

Exception, if set, is retained and should be released by the caller.

interval

Time to run the test

reraiseExceptions

If YES, will re-raise exceptions

Declared In

GHTesting.h

sharedInstance

The shared testing instance.

+ (GHTesting *)sharedInstance

Declared In

GHTesting.h

Instance Methods

isTestCaseClass:

See if class is of a registered test case class.

- (BOOL)isTestCaseClass:(Class)aClass

Parameters

aClass

Class

Declared In

GHTesting.h

loadAllTestCases

Load all test classes that we can “see”.

- (NSArray *)loadAllTestCases

Return Value

Array of initialized (and autoreleased) test case classes in an autoreleased array.

Declared In

GHTesting.h

loadTestsFromTarget:

Load tests from target.

- (NSArray *)loadTestsFromTarget:(id)target

Parameters

target

Target

Return Value

Array of idGHTest

Declared In

GHTesting.h

registerClass:

Register test case class.

- (void)registerClass:(Class)aClass

Parameters

aClass

Class

Declared In

GHTesting.h

registerClassName:

Register test case class by name.

- (void)registerClassName:(NSString *)className

Parameters

className

Class name (via NSStringFromClass(aClass)

Declared In

GHTesting.h