I want to write some logical unit tests for classes in my Xcode application. In Xcode 4, I clicked on the project name in the Project Navigator, and below clicked on Add Target. I selected the “Cocoa Touch Unit Testing Bundle” in the “Other” section to give the new goal “product name” “tests” and finish.
Since the class that I want to test is compiled as part of my existing target application, for my new “tests” task, I immediately go to the “Phase Assembly” tab and add my existing target as the only target dependency.
Then I go to the created test.m file, import the class I want to check (under it ReleasePlanManager ) and call one of its methods. But the linker fails with an error, for example:
Undefined symbols for architecture i386: "_OBJC_CLASS_$_ReleasePlanManager", referenced from: objc-class-ref in tests.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status
So the class cannot be found, although (in my opinion) adding the purpose of the application (which is part) should be sufficient?
Any help would be greatly appreciated. Thank!
objective-c unit-testing linker xcode ocunit
shadowmatter Jun 23 2018-11-11T00: 00Z
source share