Unable to get unit tests configured for a specific scenario. Here is what I am trying:
In Xcode 4.5, I created a simple OSX “Command Tool” application project (Foundation).
Please note that Xcode does not provide the ability to add unit tests to the Command Line Tool project automatically - therefore, please do not offer to tick the checkmark; it is not: - /
In my project, I created a trivial sample class that I would like to test; for example, "Form."
I followed the instructions in the Apple Xcode Device Test Guide for Setting Up Unit Testing in a Project :
In the test project implementation (.m) file, I added imports for Shape.h and the code in the setUp() method to create an instance of the form and assign it an instance variable.
At this point, I decided to see if things would be built, and if the default test would work as before. However, when I selected Product ... Test from the menu, the build failed with the following error:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_Shape", referenced from: objc-class-ref in ExampleTests.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
Interpretation of this error is not a problem. I understand that the unit test goal is not related to the binary version containing the Shape implementation. However, I have not tested Xcode unit testing and target configuration yet. So:
What do I need to do to link the test link to the command line result? Is it possible to connect to the executable from the command line from unit test? Apple documentation applies to regular OSX applications ( *.app ) and iOS applications, and this is not the case.
I have business logic classes that I would like to develop in the command line tool (for starters), so I would like to understand what I need to do to get the unit test target running in the "Command Line Project". Thanks!
(ps Please note that I am not interested in running my unit tests from the command line - Stack Overflow has already offered "similar" questions on how to do this - but rather unit tests in the "Command Line Tool" work, the type of the project is still inside Xcode .)
Chris W. rea
source share