Unit tests are always “successful” after adding OCMock

I would like to use OCMock in my Cocoa unit tests. I downloaded the latest version of OCMock (2.0.1) and copied OCMock.framework into my project directory. In Xcode, I added a framework to the phase of the target channel unit test. Then I added code that uses the OCMock classes.

From now on, all unit tests are reported as “successful” - green light, no errors or warnings. Even after entering the calls, STFailXcode claims that "Test succeeded." Placing a breakpoint in arbitrary test methods shows that none of them are completed.

The problem persists if I comment on the code using OCMock, including directives import.

The problem disappears, that is, it STFailsstarts crashing again - when I remove OCMock from the link phase.

This is similar to another question I asked earlier, but not quite the same: in this case, the information in Log Navigator does not contain errors. What can cause this behavior? What can I do to diagnose this issue?

+5
source share
1 answer

It turns out that I was missing the build phase of the copy files for the framework, which, apparently, can lead to various issues .

This works for me:

  • Add the file copy phase to the unit test creation phase. I positioned it right before the Run Script phase, making it second to last.
  • OCMock.framework , ; + Xcode 4.6 (, - ?).
  • "Frameworks".
  • unit test Runpath @loader_path/../Frameworks.

, unit test . , " " " ", .

+2

All Articles