Why Create Mock Objects?

Posted by Chris on Stack Overflow See other posts from Stack Overflow or by Chris
Published on 2009-09-12T02:14:40Z Indexed on 2010/04/07 21:03 UTC
Read the original article Hit count: 132

During a recent interview I was asked why one would want to create mock objects. My answer went something like, "Take a database--if you're writing test code, you may not want that test hooked up live to the production database where actual operations will be performed."

Judging by response, my answer clearly was not what the interviewer was looking for. What's a better answer?

© Stack Overflow or respective owner

Related posts about mocks

Related posts about unit-testing