views:

43

answers:

1

Hi,
I'm tying to implement some test cases for my iPhone app. I have successfully set up the UnitTest-Target as described here: iPhone development guide

I'm also able to build a simple test case:

- (void) testPass {
STAssertTrue(TRUE, @"");
}

But when I'm trying to instantiate a class that has some methodes that return UIColors the test fails:

@interface BCGlobals : NSObject {
}
+(BCGlobals*)instance;
-(UIColor*) redTextColor;
-(UIColor*) greenTextColor;
@end

The error message is: 'UIColor' undeclared (first use in this function)

Is it possible, that I cannot test classes referring to UIKit within a logic test in XCode?

+1  A: 

Did you:

#import <UIKit/UIKit.h>

?

Graham Lee
In the test case: SenTestingKit/SenTestingKit.h and UIKit/UIKit.h In the tested class: Foundation/Foundation.h
Shingoo
I don't know if you copy pasted the code but the second method should be - (UIColor *) redTextColor;
Deepak
Corrected that, thanks... seems like stackOverflow is interpretating the * as an enumeration...
Shingoo
Ok, now I've added the UIKit import to the tested class. And it works. But why? I do not need the import at all if I'm only building the iPhone app. Why do I need this additional import only in the case of a test case build?
Shingoo