- (void) callTestMethods { int testCount = 0; @try { unsigned int outCount; Method *methods = class_copyMethodList(object_getClass(self), &outCount); for (int i = 0; i < outCount; i++) { Method method = methods[i]; if (method == NULL) { continue; } NSString *methodName = NSStringFromSelector(method_getName(method)); if ([methodName hasPrefix:@"test"]) { NSLog(@"\n-------------------------------- Calling %@", methodName); NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; [self performSelector:method_getName(method)]; [pool release]; NSLog(@"\n---------------------------------- End %@", methodName); testCount++; } } free(methods); NSLog(@"outCount: %d", outCount); } @catch( NSException *ex ) { NSBeep(); NSLog(@"exception: %@", ex); } @finally { // dang } NSLog(@"%d tests run", testCount); }