UnitTest for Objective-C

仕事で、またXP (エクストリームプログラミング) に取り組めそうな状況になってきたから、テスト熱上昇中。仕事では、C++Javaだけど、Objective-C環境にも触れておく。

OCUnit

http://www.sente.ch/software/ocunit/

This Objective C testing framework is a based on SUnit, Kent Beck's Smalltalk unit testing framework

SUnitの移植ということ。
"Cocoaと遊ぶ - OCUnitを使う"、"Moc de Programming - OCUnit"を見ると、テストに利用するmacroはずいぶんとシンプル。型に対して柔軟なSmalltalkと、その流れを受け継いでいるObjective-Cの利点なのかな。
JUnitからユニットテストに触れた身としては、assertHogeという言い回しではなく、shouldというのが話言葉っぽくてイイ感じに見える。
ProjectBuilder/Xcodeと連携して使うようにできる。
継続的にアップデートされているのもいい感じ。
前に少し使ってみた。

ObjCUnit

http://oops.se/objcunit/

What is the relationship with OCUnit? (stephan@stack.nl)

Nothing more than that it is a framework for unit testing for Objective-C and that I have contributed a little to OCUnit in the past. Basically, we used to use OCUnit, then as we did more and more Java stuff at Oops, we felt uncomfortable with the SUnit (for Smalltalk; the original *Unit framework) flavor of OCUnit. Then MalteTancred played with "porting" JUnit to Objective-C one evening, and we thought it to be of interest to other people, so we released it. --PeterLindberg

SUnitなのりのOCUnitじゃなくってJUnitなのりのものを作ったそうだ。
"Moc de Programming - ObjcUnit その1"、"Moc de Programming - ObjcUnit その2"、"ObjcUnitについて"あたりが参考になる。
こちらもProjectBuilderと連携して使えるそうだ。ただ、最終アップデートが、2002年3月なだけに、Xcodeとも連携できるかどうかはわからない。
これは使ったことがない。

TestKit

http://testkit.sourceforge.net/

TestKit shares much of the functionality of JUnit, and it adds functionality to help programmers with the problems and challenges unique to Objective-C.

JUnitの移植にとどまらず、Objective-Cなりの工夫もしている (しようとしている?) もののようだ。
http://yatsu.info/archives/000911.htmlid:ogijun:20040219#p1にリンクがある程度で、日本語の情報がない。
Xcodeと連携できるし、これは、TestRunnerも含まれてる。JUnitの緑と赤のバーじゃないのが淋しいが、やっぱりテストの進行にあわせてバーが伸びていくのはうれしい。
名前が〜KitというのがCocoa流 (というかOPENSTEP流) でいい感じ。

で、今回はTestKitに挑戦する。