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-06 09:42:39
|
Hello Ya i got what you wanna say. But i have another problem.... Suppose i want to create test cases for system calls. for e.g. a call to createthread() or to createevent. how to provide test cases for those calls Suppose i replace those system calls with dummy functions. that's fine but = i think it will clash with system dlls. then how do i tackle this problem. Thanks. On 6/4/07, CppUnit development mailing list < cpp...@li...> wrote: > > 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 > along > > 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? > Usually, you should do so also. > > But I assume that you are not able to test B for some reason (e.g. due to > remote implementation or something else). In this case it is common sense > to > use a stub or a mock object of class B. > > In C++ you can simply exchange the B.cpp implementation file, for example= , > and > 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 > that > tests for, e.g., known input/output values or a counter of the amount of > 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 > > > -- > Marcel Winandy > http://www.prosec.rub.de/staff/winandy.html > Horst G=F6rtz Institute for IT Security, Ruhr-University Bochum > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Cppunit-devel mailing list > Cpp...@li... > https://lists.sourceforge.net/lists/listinfo/cppunit-devel > |