FrontPage
RecentChanges
FindPage
PageIndex
UnusedPages
UndefinedPages

Set your name in
UserPreferences

Edit this page



Referenced by
DoMockBoysDreamOf...




JSPWiki v2.0.36


TestsMustCommunicateTheIntent

[old:TestsMustCommunicateTheIntent]

I value MockObjects as an excellent tool, and I use and promote their use daily at the office. Please don't read this as slating the idea, but I want to pick up on TimM's comment on DoMockBoysDreamOfAnAllTestsPassWorld on TestsMustCommunicateTheIntent.

Whilst I do agree that TestsMustCommunicateTheIntent of the code under test, I'm not convinced that it is only with MockObjects that this is the case, ie: vanilla test cases can also communicate just as well (and in fact sometimes can an explicit assertEquals be more readable than a hidden myMock.verify() ?).

Yes, MockObjects most definately offers an approach to encoding tests, and given one is used to reading mock objects then the level of readability is maintained between tests. However expressing comprehension is less tangible and I guess dependant on each reader's interpretation. I'd favour stating the MockObjects ensure readability through a consistent approach to testing, rather than comprehension of the code.

I simply want to clarify here that MockObjects isn't a panacea, and as such I tentatively offer that:

  • Tests which do not use MockObjects could be more readable
  • MockObjects is not the only way to communicate intent within test cases, ie Tests can show intent quite readily without them
  • Readability is related to comprension, which is an IndividualThang?. So a tool such as MockObjects can only offer a consistent approach to this.

-- PaulS

TestsMustCommunicateTheIntent, MockObjects are for communicating the intent and testing the dependencies/interactions between objects. It depends what intent you are trying to communicate with your tests as to whether to use MockObjects; is it the end result of some code, or the interactions between objects? IvanM


Edit this page   More info...   Attach file...
This page last changed on 15-Apr-2003 10:02:26 BST by unknown.