[TIP] Which mock object framework should I use?
gustavo at niemeyer.net
Sun Nov 18 08:06:21 PST 2007
> Since you are working on a new Mock implementation, my wishlist is
> that you look at the api that is used by the simpletest package
> (simpletest.org) for mocking.
Will check it out, thanks for the pointer.
> What I like about the simpletest api is that it doesn't require too
> much typing.
I believe Mocker is quite friendly in that regard.
> Instead of : (example from pmock)
Btw, I started Mocker after Graham Carlyle (pmock's author) told me
he had dropped pmock when I offered him a patch.
> you can have:
> obj.expectOnce('some_method', ('myparam','otherparam'), 'tt')
That's how Mocker would handle it:
expect(obj.some_method('my param', 'otherparam')).result('tt')
obj.some_method('my param', 'otherparam')
Both are equivalent.
More information about the testing-in-python