仅使用变量进行单元测试 [英] using variables for unit testing only

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

问题描述

我使用目标c为iPhone的应用程序编写单元测试。
我只想在编译测试用例时使用某些变量

I am writing unit tests for an app for iPhone using objective c. I want to use some variable only when compiling for test case for example

#ifdef UNIT_TESTING 
@synthesize requestFinished, networkAvailable;//etc
#endif

现在我应该定义UNIT_TESTING当我编译单元测试,它应该输入这个代码块....否则应该通过它....

now where should I define UNIT_TESTING that when I compile for unit tests it should enter this code block.... otherwise should go past it....

推荐答案

在每个目标的预处理器宏构建设置中定义它 - 尤其是要定义宏的单元测试包目标。

Define it in the "Preprocessor Macros" build setting in each of your targets—especially the one where you want that macro defined, the unit test bundle target.

这篇关于仅使用变量进行单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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