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 Answer
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 to add XCTest to your project.
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!
2 Comments
Richard Shin
Beautiful, absolutely beautiful. This saved me/my company a lot of headaches since we were previously adding every source file to the test target. The genesis of this problem was when I noticed that some objects in our unit tests were failing a basic
isMemberOfClass: test in isEqual:. Even though the two objects being tested for equality were created from the same source file, they came from two different compiled sources: one from the project under test, and one from the unit test project.Dermot
Link is broken. I assume this is the updated link: developer.apple.com/library/ios/documentation/ToolsLanguages/…