Appendix B
xUnit Terminology

Mocks, Fakes, Stubs, and Dummies

Are you confused about what someone means when that individual says "test stub" or "mock object"? Do you sometimes feel that the person you are talking to is using a very different definition? Well, you are not alone!

The terminology for the various kinds of Test Doubles (page 522) is confusing and inconsistent. Different authors use different terms to mean the same thing. And sometimes they mean different things even when they use the same term! Ouch! (See the sidebar "What's in a (Pattern) Name?" on page 576 for why I think names are important.)

Part of my reason for writing this book was to try to establish some consistency in the terminology, thereby giving people a set of names with clear definitions of what they mean. In this appendix, I provide a list of the current sources and cross-reference the terminology they use with the terminology used in this book.

Role Descriptions

The table on page 742 is a summary of what I mean by each of the major Test Double pattern names.

image

Terminology Cross-Reference

The following table lists some sources of conflicting definitions just to make it clear what the mapping is to the pattern names used in this book.

image

  • Unit Testing with Java [UTwJ] uses the term "Dummy Object" to refer to what this book calls a "Fake Object."
  • Pragmatic Unit Testing [PUT] describes a "Stub" as an empty implementation of a method. This is a common interpretation in the procedural world; in the object world, however, it is typically called a Null Object [PLOPD3].
  • Some of the early Mock Objects literature could be interpreted to equate a "Stub" with a "Mock Object." The distinction between the two has since been clarified in [MRNO] and [MAS].
  • The CORBA standard 1 and other remote-procedure call specifications use the terms "stubs" and "skeletons" to refer to the automatically generated code for the near- and far-end implementations of a remote interface defined in IDL. (I've included this information here because it is another use of a term that is commonly used in the TDD and automated developer testing community.)

The sources quoted in the preceding table are provided here:

image

xUnit Terminology Cross-Reference

The following table maps the terminology used in this book to the terminology used by specific members of the xUnit family. This list is not intended to be exhaustive but rather is meant to illustrate the adaptations of the standard xUnit terminology to the idioms and culture of each language and community.

image

image

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.150.89