2009.01.15 21:12
Our progress was too slow like a snail's pace, but, today, we'll go far from yesterday.

We already made compilable source code, but it does not work as our wish.
Constructor should store specified method name to be tested, and method which is selected, should call method in class.
So, i'll change one item to TODO list as follows.
TODO List
- Call test method --> Call test method dynamically.
- Call 'setUp' before calling test method
- Call 'tearDown' after calling test method
- Call 'teatDown' whether test is passed or not
- Execute multiple test cases
- Print collected test case result
and, here is its source code
WasRun.h
@interface WasRun : NSObject {
bool wasRun;
NSString* name; // <-- newly added for store method name to be called.
}
- (id) initWithName: (NSString*) methodName;
- (void) testMethod;
- (bool) wasRun;
@end
WasRun.m
#import "WasRun.h"
@implementation WasRun
- (id) initWithName: (NSString*) methodName
{
[super init];
wasRun = NO;
name = [[NSString alloc] initWithString: methodName];
return self;
}
- (void) testMethod
{
SEL exeMethod = NSSelectorFromString(name);
[self performSelector: exeMethod];
}
- (bool) wasRun
{
return wasRun;
}
@end
Okay, it looks finished. Let's check we can complete this step.... Build and RUN!!! gogogo!!
...
What the hell -_-;; Critical runtime error is happen. maybe, there is some exceptional case...
Stack frame is loading.... it looks there is stack overflow... (actually, i'm very beginner at XCode...)

Debugger displays that what is problem. in my main function, i called test function which is named "testMethod".
But, in WasRun class, "testMethod" is the name that test function's own name, and it called itself recursively!!!
So, i changed method name "testMethod" to "Run". (Actually, in my text book, it is already changed -_-)
Rebuild it and run... Okay!! it works well ;-)
'Programming > TDD Practice' 카테고리의 다른 글
TDD기법을 적용하여 Objective-C기반의 xUnit framework만들기 #5 (0) | 2009.01.19 |
---|---|
TDD기법을 적용하여 Objective-C기반의 xUnit framework만들기 #4 (0) | 2009.01.15 |
TDD기법을 적용하여 Objective-C기반의 xUnit framework만들기 #3 (0) | 2009.01.15 |
TDD기법을 적용하여 Objective-C기반의 xUnit framework만들기 #2 (1) | 2009.01.13 |
TDD기법을 적용하여 Objective-C기반의 xUnit framework만들기 #1 (0) | 2009.01.12 |
TDD Practice (0) | 2009.01.12 |
TAG TDD