[Cppunit-devel] Question on TestSuite::addTest() and Test Fixture instantiation
Brought to you by:
blep
From: Mark W. <mwi...@ie...> - 2003-04-04 21:31:41
|
Hi, A work colleague noticed that her test classes were getting instantiated once per test method when using the helper macros (as in the heirarchy demo). We are using CppUnit 1.8.0. I had assured her that this was probably a bug, and I would look into what might be causing it. I was under the impression, with the "xUnit" frameworks, that the "fixturing" gets instantiated once per suite of test methods on that fixture. But, after looking into the 1.8.0 helper macros, TestSuiteBuilder and TestCaller, I find this is done by design. Our goal is to have the ability to have a persistent resource, or to have a single task performed, that can be used across the set of test methods on the fixture. This may seem contrary to setUp()/tearDown(), but often there is a dependent piece of work that would push the test times out extraordinarily long, or take up too much resources, if done more than once per fixture. It had been our intention to do this in the constructor of the fixture. I have investigated using derivations of TestSuiteBuilder, TestFixtureFactory, and TestCaller, but I am hopefull there is a simpler way and I'm just too dense to recognize it just now. Do you have any suggestions on how we might readily accommodate that goal in CppUnit? Thanks! Mark Winrock mwi...@ie... Software Test Engineer |