Zerobase Dev Blog

コードネームYentry

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

単体で機能する。

  1. Subclass SpecContext
  2. 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.
  3. Create some spec methods.
  4. 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)

実践テスト駆動開発 テストに導かれてオブジェクト指向ソフトウェアを育てる (Object Oriented SELECTION)