A common issue I always run into is how to test asynchronous methods, especially networking calls. I used test the result of the calls, such as the parsing of return data, because testing the entire method proved impossible. I recently read an article from the excellent objc.io publication on asynchronous testing. By combining the patterns used in this article with some refactoring, I finally have my networking code under unit tests.
Continue reading

I have wanted to get better at unit testing and the tooling around it for some time. I usually start out determined to get a good amount of the code covered by unit tests, and to possibly get some UI tests built around user interactions. Unfortunately, deadlines intervene, and the tests get abandoned. With my most recent project, I decided to put all of these practices in place. This is going to require learning as I go, and I intend to document my progress here for my own learning and hopefully to help anyone else who is researching the same thing.
Continue reading

I started using Kiwi to drive unit tests on my most recent project. Kiwi is an excellent BDD (Behavior Driven Development) framework that helps drive your code design by making test expectations very clear. It greatly increases the readability of your unit tests. The Kiwi library only requires implementation files to write each spec (test). Per the documentation, you follow these steps to create a spec: Create a .m file (no header required) Add an import for the Kiwi library #import Kiwi.
Continue reading

Author's picture

Mark Struzinski

iOS dev @ Lowe’s Home Improvement

North Carolina, USA