Menu

TestCaller extensions

Tim Jansen
2001-02-01
2001-02-12
  • Tim Jansen

    Tim Jansen - 2001-02-01

    I am currently testing a modified version of the TestCaller that adds two new capabilities to the TestCaller. The first one adds a ExpectedException to the TestCaller:

    class NO_EXCEPTION
    {}

    template <class Fixture, class ExpectedException = NO_EXCEPTION>
        class TestCaller : public TestCase
    {
    // ...
    }

    If you specify the second template argument it is a failure when the test function does not return the exception given. This can safe you a lot of typing when you test error conditions.

    The extension is a new TestCaller subclass called PrototypeTestCaller. Its constructor takes a prototype fixture that is then copied for the test method invocation. This allows you to execute a test case with different parameters without using inheritance (TestCaller always uses the empty constructor). Unfortunately it is not possible to add this feature to TestCaller directly because it would then require Fixture to implement a copy constructor (like PrototypeTestCaller does).

    I would appreciate comments on this; maybe there are better ways to get what I want?

     
    • Tim Jansen

      Tim Jansen - 2001-02-12

      The patch is now available in the patch manager.

       

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.