views:

21

answers:

1

I have a unit test to test one of my model classes and I get the follow error when I try building unit test target:

"_OBJC_CLASS_$_NSMyClass", referenced from: objc-class-ref-to-NSMyClass in LogicTests.o ld: symbol(s) not found collect2: ld returned 1 exit status

I have setup my unit tests as Apple recommends i.e. separate targets.

Does anyone know what I am doing wrong?

A: 

Have you included the source under test (in addition to the test cases) in the test case target?

Graham Lee
So everytime I want to run unit tests I have to drag the .h and .m files into the compiles sources folder?
TheLearner
@TheLearner: no, just the first time you want to build the target. Unlike JUnit you can't just take a single test case file and "Run as OCUnit test case" - something which bugs me and which I'm talking about at a conference soon...
Graham Lee
@Graham Lee - so I have dragged my 'model' files into the compile sources folder - should I just leave them there and whenever I add another model drag it aswell?
TheLearner
@TheLearner: whenever you add new code that needs to be tested, yes.
Graham Lee