What are Mock objects? Can you please explain the concept? How to make use of Mock objects in C++? Any source examples will be highly helpful.
+2
A:
Hi,
In general, a mock object is referring to an instance of a class that as the name says "mocks" the functionality of the original class. This is usually simplified when coding against an interface, so when testing a component that depends on an interface, you simply implement the interface to return the results necessary to perform your tests.
You can find more information here, including the different kinds of mocks that are used for testing:
- http://msdn.microsoft.com/en-us/magazine/cc163904.aspx
- http://msdn.microsoft.com/en-us/magazine/cc163358.aspx
I hope this helps.
Thanks, Damian
Damian Schenkelman
2010-09-28 03:48:47
@Damian +1 Thanks! Wish could accept 2 correct answers!
Als
2010-09-28 07:37:16
@Als: no problem :), just glad I could help
Damian Schenkelman
2010-09-28 12:29:01