Ques 1
What is a mock object in testing, and how is it useful?
A mock object is a simulated object used to mimic the behavior of real objects in a controlled way. It helps isolate the code being tested and ensures that it interacts correctly with dependencies.
Example:
Creating a mock database object to simulate database interactions during unit testing.
Save For Revision
Save For Revision
Bookmark this item, mark it difficult, or place it in a revision set.
Log in to save bookmarks, difficult questions, and revision sets.
Is it helpful?
Add Comment
View Comments