Sunday, November 14, 2010

Using Vim for iPhone test-driven development

Few weeks ago I started toying with an idea of developing iPhone applications. Unfortunately I had never used Xcode or even Mac before so my first encounter with these things wasn't completely painless. After one or two small test applications when I got used to Objective-C and iPhone SDK I realized that I need to customize few things.

First of all I had to swap Xcode's editor for Vim which is my editor of a choice. I installed MacVim and configured it as the default editor for all text files in Xcode (Preferences > File Types).

Now that I got Vim working with Xcode I had to solve another problem, which is essential for me when developing software and that's how to write and run unit-tests. There is really nice documentation at Apple's developers site about Unit Testing Applications so first part was no-brainer.

In order to run the tests from Vim I had to find out how to run them from a command-line. That's also pretty easy using xcodebuild script which comes with Xcode.

I have created a Makefile so I could use make test to run the tests with ease.

Makefile



To make it work with Vim's quickfix I modified my .vimrc so it catches errors and warnings. Also I did set it to run the tests after each save of a .m or .h file.

.vimrc



All this made me more confortable so I could focus on actual coding instead of fighting with the Xcode's editor. In next post I would like to show how to make test execution even more automatic and less distracting using guard and Growl.

1 comment:

  1. Link 12bet.lv ▷ Best Casino in the World 2021 - Viecasino.com
    Link 12bet.lv. The 188bet most popular casino in the world with over 250 games is 12bet Link 12bet, a trusted online casino from 메리트카지노 Sweden!

    ReplyDelete