How to configure the OCUnit test kit for the framework?

I am developing a Mac OS X framework and I want to use OCUnit in my Xcode 3.2.1 project. I have completed several tutorials on setting up the OCUnit test suite. The problem is that when I create a test case that uses a function defined in one of the structure sources, I get a building error telling me that the character was not found.

I made the test package dependent on my project target, as the tutorial said, but that doesn't seem to be the problem. At first, I thought I could solve this problem by dragging the source frame files to the compilation sources section in the target set of test packages, but then all the symbols referenced by this source file started appearing in the build errors, so it seems to be a good solution / idea.

How can I configure the unit test package to build correctly?

+4
source share
2 answers

I also write unit tests against the framework, I hope I can help. You do not want to recompile the source materials for unit testing - instead, you want to link yourself to the built-in infrastructure. Here is what I suggest:

  • Open the information window for the purpose of testing the device by double-clicking on it in the side panel.
  • On the General tab, click the + sign in the lower left corner to add a linked library. Select the structure that your project creates and click Add. Close the info window.
  • In each of your unit tests, import the header files needed for this test. Since Xcode knows about the framework files, you should be able to use the #import "MyHeader.h" form rather than the angle brackets ( < and > ).

At this point, your unit tests should be built without errors. If not, perhaps learning how my unit tests are configured for CHDataStructures may help.

+4
source

I could make it work by clicking on the checkbox corresponding to my structure (the one that appears in the product section) in the file browsing table that appears in the main Xcode windows (I assume that he set the file as something like the target). Dragging the frame into the Unit Test package seems to do something different.

+1
source

Source: https://habr.com/ru/post/1302166/


All Articles