XCTest for existing project

柔情痞子 提交于 2019-12-10 19:44:03

问题


I have a big(about 700 modules) iOS project. Now I need to make unit tests for existing code(before we didn't use it). I've added new XCTest test target for my target and started to write my first test. But after compilation I've got some link errors, because modules from my project weren't be included to test target. Have I include all my modules to test target? Or there is easier way to make test target?


回答1:


Application files DO NOT need to be included within XCTest targets. Only test files should be included within the 'Compile Sources' list for your XCTest target.

Follow the Apple instructions too add XCTest to your project : https://developer.apple.com/library/ios/documentation/ToolsLanguages/Conceptual/Xcode_Overview/UnitTestYourApp/UnitTestYourApp.html

Within the Application target, make sure the compiler option "Symbols hidden by default" is set to NO.

Here is a blog post with screenshots if you get stuck: http://hackazach.net/code/2014/02/24/slim-xctest-targets



来源:https://stackoverflow.com/questions/21055224/xctest-for-existing-project

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