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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
The patch is now available in the patch manager.