SSブログ

Properties of a good unit test [プログラマー現役続行]

The Art of Unit Testing: With Examples in .net

The Art of Unit Testing: With Examples in .net

  • 作者: Roy Osherove
  • 出版社/メーカー: Manning Pubns Co
  • 発売日: 2009/06/28
  • メディア: ペーパーバック

この書籍の1.2節「Properties of a good unit test」では、unit testは次のproperties(性質)を持つべきであると述べられています。
  • It should be automated and repeatable.
  • It should be easy to implement.
  • Once it's written, it should remain for future use.
  • Anyone should be able to run it.
  • It should run at the push of a button.
  • It should run quickly
非常に的確に述べられていると思います。

一方、すべてを結合して行うテストをIntegration Testと呼び、それらの問題点を述べられています。ただ、Integeration Testは手作業で行うという前提(先入観)で述べられており、Integration Testそのものが上記の性質を持ち合わせていたらどうかということには言及されていません。

システム全体となると最後の「It should run quickly」を達成するのは困難か、あるいは、かなり工夫をしないと達成できないかもしれません。しかし、システム全体のテストも上記性質を満たすように構築するように努力することは価値があると思います。
nice!(0)  コメント(0)  トラックバック(0) 

nice! 0

コメント 0

コメントを書く

お名前:[必須]
URL:
コメント:
画像認証:
下の画像に表示されている文字を入力してください。

Facebook コメント

トラックバック 0