I did a lot of building the framework - basically calling the classes / interfaces that I wanted to test. There was no extra work in the classes.
I also created classes several times that made public methods virtual. I got from them and created test classes / objects. Methods of test objects are called parent (real classes) methods, and all calls and results are recorded. It was more for registration than for testing, but it also worked.
The methods described above, I did before all the hype about unit testing and the like. (around the end of the 1990s)
Then it worked well, but I did not work too much with Junit / nunit material and really want to give them a twist on real projects.
for one method
class thing
{...
public: virtual DoStuff (); , ..};
class ThingTest: public Thing
{
virtual DoStuff ()
{
// write down the call and parameters.
// make a call to the parent
// write the return value
// return the return value
}
};
Tim
source share