PackageDescription: Mocketry(Bundle)


Mocketry

Last published: February 18, 2008 by 'dionis'


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 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]
...

Package Mocketry-SpecDSL shows how create new DSL clauses.
See examples in acceptance tests.