Mastering Time and Space: Testing the Objective-C Runtime

Testing in Objective-C is not as powerful or useful as it could be. The out-of-the-box tools are still a bit anemic and a lot of testing ends up being confined to unit testing because it’s too much of a hassle, or too slow, to test what should be. I’d like to cover some improvements to how BDD can be done, using Cedar as an example, and several custom extensions to Objective-C’s runtime (which would function in any testing environment). (‘Try that in swift!’ could be a subtitle for this talk. . . . ) Specifically, I’ll cover how to intercede in the runtime to make time pass without waiting, to intercept & munge network communications (including with NSURLSession, which was more challenging than previous techniques), to collapse animations, and how to otherwise get Apple’s systems out of the way to test what you want to. I’ll also talk about what to test and what not to test, to dial in the level of coverage desired to fit the situation. The techniques covered include method swizzling and posing, so I selected ‘advanced’ above. But depending on the audience, I could focus on the more interesting and unusual tools or try to support a mechanism for making BDD testing drive good implementations. I’m pretty flexible. If this is the place to be less than humble, I’ve got a 5.0 rating on ‘ratemyprofessor.com’, won Berkeley’s teaching award, and in general try to be entertaining.

Get more development news like this

This talk was recorded at AltConf 2015. Watch all the videos!

About the content

This content has been published here with the express permission of the author.


Joshua Marker

Joshua Marker

4 design patterns for a RESTless mobile integration »

close