using variables for unit testing only

筅森魡賤 提交于 2020-01-13 11:25:47

问题


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

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....


回答1:


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.



来源:https://stackoverflow.com/questions/3961938/using-variables-for-unit-testing-only

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!