0

I have an iOS project that comes from an older Xcode (4.6.3) and that did not include a test target by default, as projects in latest Xcode versions seem to include. I now have Xcode 5.1.1. on a Mac that is running OS X 10.8.5. I've reading this Apple's document regarding unit testing in Xcode, but it looks like you need OS X Mavericks, at least for installing and configuring OS X Server, don't you?

I'd appreciate some guidelines to follow to add a test target to my project and how could I integrate a testing process in my workflow if I do not have OS X Maveriks.

Thanks in advance

EDIT: Is there anyway of run tests in normal running of the app? I mean, I need to test some cases that involve the update of data at certain hours, and the update of some parameters and the GUI after that data update... how could I do this? Thanks

AppsDev
  • 12,319
  • 23
  • 93
  • 186

2 Answers2

0

You need Mavricks if you wish to use the Xcode service, which is Apple's continuous integration server. You do not need Mavricks to run unit tests, however you will miss out on the pretty in-xcode reports.

Without Mavericks, you can run unit tests manually by pressing CMD+U or going to Product->Test.

You can also setup your own continuous integration service and run the unit tests with a command line script. You'll have to pick a CI server, something like Jenkins or many alternatives, and look up a how-to for that system.

Community
  • 1
  • 1
BergQuester
  • 6,167
  • 27
  • 39
  • Thanks. I've added a test target to my project and I've run the test example... I get an Xcode's popup saying that the test failed, but I do not get any red mark in the Test Navigator as I can see in the screenshots of the Apple's Test Navigator Help document... Is this also because I don't have OS X Server? – AppsDev Jun 02 '14 at 09:44
  • It probably means that the tests failed before they could actually be run. Run the tests again and switch to the log navigator to see how they failed. – BergQuester Jun 02 '14 at 14:07
0

Do you redirect NSLog/stderr anywhere?

I encountered this problem too with no red marks and failing test of '1 == 1'.

My app was catching NSLog calls to a file and not letting the system get them. Once I disabled the redirecting of logs freopen(filepath, "a", stderr) test started passing and green checks and red crosses appeared.

I did this for an external accessory device that hooked up through the lightning port and couldn't send the logs to the mac. You mentioned how you want to run the test during the normal running of you app, so I figured you may have saved the logs so you could read them away from you mac.