Menu

Method Testing which accepts parameters

Anonymous
2001-07-11
2001-07-13
  • Anonymous

    Anonymous - 2001-07-11

    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

     
    • Kent Dahl

      Kent Dahl - 2001-07-13

      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.)

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.