iOS Integration Testing, Part 2
A continuous integration server for running your tests on every commit.
Written by Jim Puls.
Heads up, we’ve moved! If you’d like to continue keeping up with the latest technical content from Square please visit us at our new home https://developer.squareup.com/blog
A few months ago, we released KIF, our integration testing framework for iOS. We’ve heard from dozens of teams and companies using KIF to keep their apps functional, and we have over 600 followers and 50 forks on GitHub. The response has been astounding.
Of course, once you’ve written a whole series of tests, you’ll want to run them after every single commit. This is called continuous integration, and without it, you’ve squandered much of the value of automating your testing in the first place. But since comprehensively testing your app can involve running through it in dozens or even hundred of different permutations, it can be a slow process. As such, you want to set up a server that does it for you.
At the end of the post in July, we mentioned that you can use KIF in a continuous integration setup using a nice hack called WaxSim with the CI server of your choice. That works relatively well, but it requires a lot of work:
- Write your KIF tests
- Set up a server like Jenkins or CruiseControl.rb
- Install the appropriate plugins to work with Git
- Write a script to run your app in WaxSim with KIF tests turned on
We went through the entire process at Square — in our case, first with CruiseControl.rb and later with Jenkins — and we decided it left a lot to be desired, so we did what we always do: we innovated.
Today we’re happy to announce Zapp, a continuous integration (CI) server that tells KIF what to do. Among our goals in making Zapp were ease of setup and compatibility with your existing systems; to that end, Zapp has no dependencies on your system beyond Xcode 4.2 being installed. Zapp also outputs build RSS feeds in the same format as Jenkins does, so you can use it with aggregators like CiMonitor.
Setting up Zapp couldn’t be simpler: all you do is pick a folder that you’re already cloned on to your machine, pick the scheme you’re running, and pick the simulator version you want to use to run it.
Zapp will poll your remote repository every minute or so to see if anything new has shown up, and if it has, Zapp will queue a build. If all of your KIF tests pass, your builds will be green; if any of them fail, your builds will be red.
Just like we did with KIF, we’re making Zapp available as open source on GitHub, and more information is available in the embedded README. Check it out, and let us know what you think. Discussion is welcome at the KIF discussion group, or use the tag “zapp” on Stack Overflow. We’ve found Zapp really useful, and we hope you do too.