• A Dummy Object is a placeholder object that is passed to
the SUT as an argument (or an attribute of an argument) but is never
actually used.
作为对象参数的替身传给SUT,通常没有任何实际作用。
• A Test Stub is an object that replaces a real component on which the
SUT depends so that the test can control the indirect inputs of the SUT.
It allows the test to force the SUT down paths it might not otherwise
exercise.简言之,Test Stub可以控制间接输入,从而保证测试代码SUT的执行路径。
此外:子模式Responder injects valid values, Saboteur injects errors or exceptions
• A Test Spy, which is a more capable version of a Test Stub,
can be used to verify the indirect outputs of the SUT by giving the test a
way to inspect them after exercising the SUT.
Test Spy可以说成是有记录功能的Test Stub
• A Mock Object is an object that replaces a real component on which
the SUT depends so that the test can verify its indirect outputs。
和test Stub 不同的是,Mock object主要用来验证间接输出。
• A Fake Object (page 551) (or just "Fake" for short) is an object that
replaces the functionality of the real DOC with an alternative implementation
of the same functionality.
即对功能的简单实现,替换DOC。通常情况下使用Fake Object是因为测试DOC无法获取、太慢或者有副作用。












0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.