#13 Quiet Mocks

open
nobody
None
5
2007-04-18
2007-04-18
No

Frameworks such as rspec support "Quiet" mocks which allow you to do one expectation per test. This (some would argue) gives a cleaner more BDD style test suite.

Basically the feature I'm after is a QuietMock object which verifies only the expectations that have been set and not the ones that haven't (stubbing them instead). To quote rspec's null_object (http://rspec.rubyforge.org/documentation/mocks/mocks.html):
it "instructs the mock to ignore (quietly consume) any messages it hasn’t been told to expect – and return itself".

Currently to achieve a one expectation per test you have to stub out all the behaviours you AREN'T testing which can become just as messy as the monolithic test.

Thanks in advance.

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks