SmalltalkのBDDフレームワーク(BabyMock、SSpec、Mocketry)
組み合わせは、
- SUnit + BabyMock
- SSpec + Mocketry
のいずれか。前者でいきたい。
BabyMock
SUnitと使う。
The recommended way of using BabyMock is to subclass BabyMockTestCase and write the test case in SUnit style. BabyMockTestCase extends from SUnit TestCase and has a instance variable called context.
なにこれカッコいいw
『実践テスト駆動開発』(Growing Object-Oriented Software Guided by Tests)に書かれていたことがまさに実践されてて感動。こんなにスラスラSmalltalkを書けるようになりたい。
この動画を見ても何やってるか分からない人は『実践テスト駆動開発』を読んだらいいです。あとPharo/Smalltalk特有の諸々を知りたければ Pharo by Example Chapter 6: The Pharo programming environment が分かりやすいですよ。
SSpec BDD testing framework
単体で機能する。
- Subclass SpecContext
- Create method category "specs". Only methods in the category named "specs" will be run as part of the spec, so you can use helper methods in other categories which will not run.
- Create some spec methods.
- Finally, to run the spec using the text runner:
TextSpecRunner verbose run: SampleContext. Transcript endEntry
Mocketry
SSpecと使う。
Mocketry - mock objects framework with SSpec functionality.
see: ESUG: TDD with Mocks in Smalltalk
I will introduce Mocketry framework that helps writing and maintaining mockist tests, and facilitates assertion specification.
実践テスト駆動開発 テストに導かれてオブジェクト指向ソフトウェアを育てる (Object Oriented SELECTION)
- 作者: Steve Freeman,Nat Pryce,和智右桂,高木正弘
- 出版社/メーカー: 翔泳社
- 発売日: 2012/09/14
- メディア: 大型本
- 購入: 4人 クリック: 261回
- この商品を含むブログ (24件) を見る