XCode 5 unit testing: starts my app

前端 未结 7 1766
挽巷
挽巷 2020-11-29 23:04

When I run my tests in XCode 5, the main window of my OS X app appears on the screen for a couple of seconds while running the tests. Why? Even if I uncomment all my tests i

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-29 23:47

    Thats right, you have to delete the "Bundle Loader" and "Test Host" from your build settings.

    But you have to add the necessary implementation files to your unit test target. The necessary files are what you want to use in your unit test cases. You need to do this because in logic tests XCode wont compile the whole application. So some of your files will be missing.

    This is en error message if you have left out a file:

    Undefined symbols for architecture i386:
      "_OBJC_CLASS_$_Module", referenced from:
          objc-class-ref in Lobic Network.o
          objc-class-ref in Logic_Unit.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    

    You can add the missing files by selecting the implementation file and bringing up the file inspector. There will be a section named "Target Membership" and there you can set the files target membership to your unit test also.

提交回复
热议问题