Hi,
I am trying to test a c++ class(using CppUnit) which has some methods that takes different objects as parameters.I am able to test those methods that are not taking any parameters.
Can anyone will guide me in this regard.
Regards
Gopinath
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You want testing your application class (lets call it Math) and it has methods that takes arguments (say, Math::add(int,int)), right?
Then you still write a test method taking no arguments in your test class (MathTest). The MathTest::testAdd method body would then pass on the objects to the Math::add object being tested.
Those objects could be created locally, or by the setUp method.
( Then again I might have misunderstood you completely. )
Personally I was wondering about creating a version of TestCaller that would accept some struct that is passed onto the test method. That way test data could be somewhat more decoupled from the test methods. (Sounds a wee bit better than my current cut'n'paste, hard-coded values and occasional iterating in my test functions, but still not too elegant.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I am trying to test a c++ class(using CppUnit) which has some methods that takes different objects as parameters.I am able to test those methods that are not taking any parameters.
Can anyone will guide me in this regard.
Regards
Gopinath
You want testing your application class (lets call it Math) and it has methods that takes arguments (say, Math::add(int,int)), right?
Then you still write a test method taking no arguments in your test class (MathTest). The MathTest::testAdd method body would then pass on the objects to the Math::add object being tested.
Those objects could be created locally, or by the setUp method.
( Then again I might have misunderstood you completely. )
Personally I was wondering about creating a version of TestCaller that would accept some struct that is passed onto the test method. That way test data could be somewhat more decoupled from the test methods. (Sounds a wee bit better than my current cut'n'paste, hard-coded values and occasional iterating in my test functions, but still not too elegant.)