That I knew but my problem is that *all* resources are initialized *at once* before running the test suite. I would need *only* the proper resource to be initialized before running all tests in every TestCase subclass... My problem lies in the fact that the resource I need is a singleton instance that is initialized based on specific parameters, each time different from one test case to another. So what happens is that all tests cases end up using this singleton with the way it was last initialized before running the test suite, which ain't good! ----------------- Benoit St-Jean Yahoo! Messenger: bstjean A standpoint is an intellectual horizon of radius zero. (Albert Einstein) ________________________________ From: Mariano Martinez Peck <marianopeck@gmail.com> To: Pharo-project@lists.gforge.inria.fr Sent: Wed, January 12, 2011 1:48:13 PM Subject: Re: [Pharo-project] SUNit On Wed, Jan 12, 2011 at 7:13 PM, Benoit St-Jean <bstjean@yahoo.com> wrote: Is there any way to initialize a TestCase subclass *once* and set up all the necessary stuff I need for all test cases in that subclass ?
Let's say I want to test some socket stuff and connect only ONCE (and reuse that socket over and over, leaving it open), how should I proceed? I don't want to open and close the socket with #setUp and #tearDown each and every time so a one-time initialization for the class (and a proper cleanup ) everytime I run the test suite is what I am looking for. Suggestions? Is there any Sunit version/fork/extension that would allow me to do that?
As Lukas said, the best solution here is using TestResource. I did exaclty what you describe there for the SqueakDBX tests and the connections to the database. Did I miss something obvious and I have exactly what I need in front on me in my class browser right now or we can't do this with what's there now?
If it's not there, does anyone think it would be worth we add such a feature ? I volunteer to get it done!
tia!
----------------- Benoit St-Jean Yahoo! Messenger: bstjean A standpoint is an intellectual horizon of radius zero. (Albert Einstein)