From: Tammo F. <tam...@of...> - 2001-09-20 13:05:31
|
Hello Steve, Lucas, Vincent, the thread on EasyMocks vs. MockObjects is quite interesting. IMHO, there are two interesting comparisons combined in one here: 1) Generating Mock Objects vs. Writing Mock Objects Generated Mock Objects are fast available. As they have a predefined behavior, their code does not need not be read for understanding a test case that uses them. Hand-crafted mock objects take quite a lot of time. However, complex interfaces sometimes deserve this work, at least if the Mock Objects have to fulfill additional behavior (and these Mock Objects should be tested). To understand a test case using written Mock Objects, either their code has to be read, or their behavior has to be known. 2) Generating Statically vs. Generating Dynamically Statically generated Mock Objects lead to a fast definition of mock objects that feel like hand-crafted mock objects, as the generated names can follow the same naming conventions. However, when refactoring is applied to an interface, there is some work involved to get the code running again. Dynamically generated Mock Objects do not require to interrupt the flow of code writing for introducing new Mock Objects,they are available immediately. And as they use the interface itself for recording a part of the behavior, they are quite stable when refactoring is done on the interface. Method or Interface renaming does not break the test code. However, generated Mock Objects currently have technical limitations. And the code is harder to read than code using hand-crafted or statically generated mock objects. What do you think? - Tammo - Tammo Freese fr...@ac... |