Testing with KIF

Posted on Thursday, April 2, 2015 in iOS , Testing 
by Eric Berna

How Could I Miss This?

I’ve been professionally building iOS apps for many years. All that time I’ve known about automated tests. I’ve written many unit tests that cover computations and data manipulations in my code. Yet I’ve struggled with testing iOS apps.

I work for a design firm, so when our customers have projects where presentation is their primary concern they think of us. Most of the apps I work on are more about the presentation than the collection or manipulation of information. Testing the user interface of iOS apps using Apple’s tools included with Xcode is very difficult. So I generally didn’t write automated tests for much of our code.

Last week I heard about KIF, a iOS testing framework. Today I got a chance to play with the testing framework. I went through the Ray Wenderlich tutorial on KIF. Where has this been? Why did I miss this? It makes automated UI testing of iOS apps a breeze. KIF is built on XCTest, so writing and running tests is just like running XCTests.

The Ray Wenderlich tutorial is a year old, and a bit out of date. If you try it, download the example code, delete the Cocoapods artifacts (the workspace, the pods folder, and the podfile). Then follow the instructions from the KIF readme file for installing KIF through Cocoapods. Then the tutorial mostly just works.

Fishy Thoughts:
"What's water?"