Search code examples
xcodexcode4ocunit

Do I have to do something to get OCunit tests to compile out of box with XCode 4?


I just installed XCode 4 today (using Apple mac app store), and I created a new Mac OS application, and tried to switch to test mode,and build the test skeleton code it generated for me. It failed here:

In mytests.h:

#import <SenTestingKit/SenTestingKit.h>

The error is:

file://..mytests.h: error: Lexical or Preprocessor Issue: 'SenTestingKit/SenTestingKit.h' file not found

Now, when I use locate from the terminal to find SenTestingKit.h, I notice it exists under the /Developer-old/Library/Frameworks folder (which is what XCode 4 installer renamed my /Developer folder to). There is no new /Developer/Library/Frameworks. And I can't seem to find SenTestingKit.framework on my disk, other than the developer-old one.

What's up? It seems SenTestingKit.framework is not shipped with XCode 4.

Update:

Furthermore, When I copy my old SenTestingKit framework from XCode 3 into /Developer/Library/Frameworks, it sort of builds, but it doesn't work the way I would expect. The dummy test is designed to just fail, but when I "run test", I just get the normal cocoa app document window opening, and no indication that my test has failed (as I intend it to do).

This is pretty bad. I can't get a Unit test to FAIL. That's not the usual situation for me, you understand.


Solution

  • You will maybe need to import the framework into your project. Otherwise, the header file won't be recognize.

    If you can't see the framework you're looking for, you can adjust the framework look paths in your project's build settings.