问题描述
我想为我的iPhone应用程序实现一些测试用例.我已经按照此处所述成功设置了UnitTest-Target: iPhone开发指南
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,@");
}
但是,当我尝试实例化具有某些可返回UIColors的方法的类时,测试将失败:
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;
@结尾
错误消息是:未声明'UIColor'(此功能中的首次使用)
The error message is: 'UIColor' undeclared (first use in this function)
是否有可能无法在XCode的逻辑测试中测试引用UIKit的类?
Is it possible, that I cannot test classes referring to UIKit within a logic test in XCode?
推荐答案
您是否做过
#import <UIKit/UIKit.h>
?
这篇关于UIKit和单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!