Over a million developers have joined DZone.

Unit Testing Broken in Xcode

DZone's Guide to

Unit Testing Broken in Xcode

· Mobile Zone
Free Resource

Download this comprehensive Mobile Testing Reference Guide to help prioritize which mobile devices and OSs to test against, brought to you in partnership with Sauce Labs.

I posted before about how poor support for unit testing was the achilles heel of Xcode, an otherwise superior development environment. Well, at least we were able to hobble along on it before. Now it‘s completely broken.

Seems that Apple has broken unit testing before. The amazing part is it‘s something super stupid, and they have not patched it. Apparently the code that captures the logging is confused about the time.

Ironically, I was thinking about doing a post on how you don‘t need unit tests as much on iOS because you can just run things so fast and the simulator is so complete. But it is depressing to see evidence that they are not even doing continuous integration, and don‘t care if we can‘t.

To reiterate: Xcode 4 looks insane. I am dying for the built in git support and the melding of Interface Builder, but for chrissakes, we need some super simple stuff on the testing front:

  1. support that doesn‘t just break
  2. better support for continuous integration testing
  3. an open console window that can show the results of running a test, having to drill open a tree for each run is beyond insane

I bet that Apple‘s position on this is that the people calling for this stuff are a squeaker minority. My position is that the worst possible future for iOS is that the ecosystem only spawns simple apps.

Turns out there was a patch put by someone on github. It fixed the unit testing, but hamcrest is still broken. For now, it‘s not working only in iOS projects. So tomorrow I‘ll start pulling things apart and moving a lot of the core code into frameworks. That‘ll solve this problem for now.

Update: So I peeled the whole huge data model out of the app and into a framework and then dragged one of the tests and everything works fine. Considering the size of the transplant, it was pretty pain free. This is one other area that the Apple docs are a tad bit lacking: there should be more discussion of modularizing apps. Even the Xcode Project Management Guide contains no serious discussion of this topic.

Analysts agree that a mix of emulators/simulators and real devices are necessary to optimize your mobile app testing - learn more in this white paper, brought to you in partnership with Sauce Labs.


Published at DZone with permission of Rob Williams, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}