How to create dummy object of legacy code in Unit Test project?
I am working on legacy c++ project,they have no unit test cases so i am planning to write unit test(CPPUNIT) case wherever i touch the code in that huge project...
I am new to cppunit, my question here is suppose i have a originally written function, internally that function creates a object of another class and call the member function of that class then get some data, then actual logic....
In this kind of situation in my new Unit test project, how to write unit test case? how create mock object of that class?
Or please reply me with proper link where i can explore more on cppunit...
Re: How to create dummy object of legacy code in Unit Test project?
It's no different when using CPPUnit than in any other situation. If you need to have a class replaced by your mockup class just make sure it's that class that gets linked and not the original. How that is done all depends on how the original files are tied together.
For CPPUnit examples just browse the homepage http://cppunit.sourceforge.net/doc/l..._cookbook.html