12 Apr 2005

xUnit Naming - Stub vs Mock

Gerard Mezaros is trying to find a common vocabulary for unit testing.
Personally I make a difference between Stubs and Mock.
For me, a Stub is just an object that return the same value over and over.
For example:
String Stub.getMethod() { return "test";}
Stub is a dumb object!
A Mock object, is more intelligent, it can test itself. You can use it and then do
mock.verify()
to check if it state is valid.
That's a big difference in my opinion.

No comments: