Am Montag, 4. Juni 2007 schrieb CppUnit development mailing list:
> Can Any body tell me how to test any module that is itself dependent on
> other modules.
> For example.
> i have class A having module named aProc().
> And suppose aProc() makes a call to any module declared in other class,
> lets say B.
> So here in Class A aProc() is dependent on b.bProc()'s output.
> So my question is that do i need to make a TestSuits for class B also alo=
> with class A.
> Remember i want to unit test only Class A and not B.
What is the reason that you do not want to test class B in your scenario?=20
Usually, you should do so also.
But I assume that you are not able to test B for some reason (e.g. due to=20
remote implementation or something else). In this case it is common sense t=
use a stub or a mock object of class B.
In C++ you can simply exchange the B.cpp implementation file, for example, =
provide your own implementation. This could be rather empty and just enough=
code that A is working (stub), or it could contain additional test code tha=
tests for, e.g., known input/output values or a counter of the amount of=20
calls to B::bProc(). The latter would be a mock object.
I hope I got the point and this was help for you. :-)
Horst G=F6rtz Institute for IT Security, Ruhr-University Bochum