Chapter 5. Testing Enterprise iOS Applications

If there’s one philosophy that has become entrenched in the DNA of software development in recent memory, it’s that testing is crucial. For some organizations, it means comprehensive unit testing, for others a full-on TDD approach with continuous integration and regression testing. But the chances are that you’re not going to be shipping your iOS application out the door without some significant test infrastructure.

Beyond simple unit testing, you also should have testing of the running application, which offers its own challenges. Not only do you need to have a testing framework that can successfully exercise your UI, but you also have to make sure that all your other integration components (such as backend servers and databases) are in a consistent state every time you run the tests.

Recently, more advanced metrics such as cyclic complexity numbers (CCN) have become en vogue. They recognize that just because code is fully tested doesn’t mean that it’s well written. On the other hand, developers can end up gaming the system to get lower CCN numbers, at the cost of code quality. We’ll take a look at how to generate CCN metrics automatically, later in the chapter.

It’s worth noting here that the various testing frameworks have, in my opinion, been the most poorly maintained and casually broken parts of the SDK over the time that I’ve been developing. Apple changes how (and if!) test frameworks operate without notice, and sometimes apparently ...

Get Developing Enterprise iOS Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.