问题
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