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 ;-) 







Posted by yunseong
TAG
이전버튼 1 2 3 4 5 6 이전버튼