Question 4 of 10Pro Only

What is mocking in testing and when should you use it?

Sample answer preview

Mocking is a technique for replacing real dependencies with controlled substitutes during testing. It allows you to isolate the code under test and control the behavior of its dependencies. There are several types of test doubles.

mockstubspyfaketest doubleisolation

Unlock the full answer

Get the complete model answer, key points, common pitfalls, and access to 9+ more Backend Developer interview questions.

Upgrade to Pro

Starting at $19/month • Cancel anytime