Mock objects framework

Denis Kudriashov dionisiydk at gmail.com
Mon Feb 18 17:12:16 UTC 2008


I released new version of mock objects framework named Mocketry. It is
renamed, cleanup and improved BehaviorMockup framework.

Short review:

Mocketry is smalltalk mock object framework based on specifications.

It support all kind specifications for object interactions:

   - arguments constraint
   - context specs
   - actions
   - usage specs
   - ordering messages.

Behavior specs build by pure message sends to mock objects and has full
refactoring support.

Mock objects implements some special proxy mechanizm for support development
tools (debugging).

Mocketry implements "scenario system" that allows transparent access to mock
objects. If you need mock object just get it in scenario block argument:

[:mockA :mockB |
	"some set up code"

	[mockA someMessageWith: 20.
	mockB someMessage2]
		should strictly satisfy:
	[mockA someMessageWith: (Kind of: Integer).
	mockB someMessage2 willReturn: #someValue].

	"maybe some assertions:
		var should be: true.
		... "
] runScenario

First block here is tested behavior. Second - expected message sends.

Or you can create MockObject instance variable in setUp method: "some :=
MockObject new". And you get mock object named 'some' in your "scenario
tests".

Mocketry provide special SSpec-like extended DSL based on pragmas for all
kind of specifications (state and behavior).

10 should be an instance of: SmallInteger
[ZeroDivide raiseSignal] should raise: ZeroDivide.
...
[mockA someMessage] should lenient satisfy: [mockA someMessage]
...

See squeaksource wiki http://www.squeaksource.com/Mocketry.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080218/bb556947/attachment.htm


More information about the Squeak-dev mailing list