Question on TestSuite::addTest() and Test Fixture instantiation

"Mark Winrock" <[email protected]> Fri, 4 Apr 2003 16:39:08 -0500
Newsgroups gmane.comp.lib.cppunit.devel
Message-ID <043b01c2faf2$a02ba640$6401a8c0@nicorsc012k>
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
[email protected]
Software Test Engineer



-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/