UIKit和单元测试 [英] UIKit and unit testing

查看:54
本文介绍了UIKit和单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为我的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和单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆