Re: [Cppunit-devel] How to Test a Module that is dependent on other module?
Brought to you by:
blep
From: CppUnit d. m. l. <cpp...@li...> - 2007-06-04 09:08:51
|
Hello Sandeep, 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= ng > 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= o=20 use a stub or a mock object of class B. In C++ you can simply exchange the B.cpp implementation file, for example, = and=20 provide your own implementation. This could be rather empty and just enough= =20 code that A is working (stub), or it could contain additional test code tha= t=20 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. :-) Kind regards, Marcel =2D-=20 Marcel Winandy http://www.prosec.rub.de/staff/winandy.html Horst G=F6rtz Institute for IT Security, Ruhr-University Bochum |