Mock objects framework

Denis Kudriashov dionisiydk at gmail.com
Tue Feb 19 08:27:02 UTC 2008


2008/2/18, itsme213 <itsme213 at hotmail.com>:
>
> "Denis Kudriashov" <dionisiydk at gmail.com> wrote in message
>
> >I released new version of mock objects framework named Mocketry.
>
> This looks really nice! Can you give some pointers on where to read a bit
> more about the various kinds of specs provided (state, context, usage,
> ...),


I want create site about Mocketry in the next month.
Now there is only "http://www.squeaksource.com/Mocketry" wiki.
And you can browse Mocketry acceptance tests - subclasses of
BehaviorSpecAcceptanceTestCase and SpecDSLAcceptanceTests.

and how the <pragmas> are used? (I will browse the code too :-)


 Spec DSL clauses is expressions like:
- 3 should be a kind of: SmallInteger
- Kind of: SmallInteger
First is used for immediately check variable for satisfying concrete spec
(HierarchySpec here)
Second is used in argument constraints (for example). It will check argument
for satisfying same spec (HierarchySpec).
Thus both expressions use HierarchySpec that actually know how tests object
for classes relationship.
Kind class is just DSL keyword.
Kind class>>of: returns instance of concrete spec and describes "should
expression" for it by pragma:

Kind class>>of: aClass
    <syntax: #(be a kind of:)>
    ^HierarchySpec for: aClass

Method can include many "syntax" pragmas ("syntax pathes").

Any pre-requisites? Use standard test runner?


Only pre-requisite is SMock package for Mocketry tests. Maybe Mocketry
should have two different packages: for tests and for base code. Then base
code doesn't need any pre-requisites.

About test runner:

With Mocketry use can use any Testing framework and TestRunner that you
want.
You doesn't need create special Base TestCase class that provide mock
objects facilities.
If you need mock object just get it from scenario block argument or testcase
inst var (empty or initialized in setUp method (for example) by "instVar :=
MockObject new").
In test methods you don't worry about what is mock objects, you just write
specification of objects interaction and test it.
Scenario system transparently creates and controls mock objects by method
context.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20080219/aae9b1db/attachment.htm


More information about the Squeak-dev mailing list