Definition

mock object

A mock object is a simulated object that mimics the behavior of a real object in controlled ways. Mock objects are often employed in unit testing to scrutinize the performance of actual objects. In this context, an object is the smallest testable part of an application. A mock object makes use of the same interface as the element of code it is intended to imitate.

A mock object can be useful in place of a real object that:

  • Runs slowly or inefficiently in practical situations
  • Occurs rarely and is difficult to produce artificially
  • Produces non-deterministic results
  • Does not yet exist in a practical sense
  • Is intended mainly or exclusively for conducting tests.

This was last updated in March 2007
Posted by: Margaret Rouse

Email Alerts

Register now to receive SearchSoftwareQuality.com-related news, tips and more, delivered to your inbox.
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

More News and Tutorials

Do you have something to add to this definition? Let us know.

Send your comments to techterms@whatis.com

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: