2

I'm trying to use OCMock to mock a network connection in order to stub my network requests for testing purposes using XCode UI Tests.

As XCode UI Tests are run on a different instance than the app, I can't access my project's code from the tests, thus making it impossible to create mock objects inside them.

What I'm trying to do is detect if I am running a test, and then create a partial mock of my the network connection within my AppDelegate so I can use OCMStub._andCall to retrieve stubbed data instead of a real response.

I have my app set up successfully using launchArguments to determine if I am running tests, and I have OCMStub._andCall working fine when I run the app in a simulator.

My issue is that when my XCUITests (or even XCTests) are run, I receive an issue within my AppDelegate, telling me that 'OCMock/OCMock.h' files are not found. Because the app runs fine in simulator, I am completely confused as to why OCMock isn't being found when run inside tests.

ecatalano
  • 687
  • 1
  • 4
  • 17

0 Answers0