Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs
Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs
- Subject: Re: JUnit4 testing of EOs: InvocationTargetException on subsequent runs
- From: Paul Hoadley <email@hidden>
- Date: Mon, 14 Dec 2009 16:30:06 +1030
For the archives:
On 13/12/2009, at 1:11 AM, Q wrote:
>>> 2. Ensure all tests classes that use EOF inherit from ERXTestCase
>>
>> I'm somewhat of a JUnit novice: wouldn't that result in mixing the JUnit3 and JUnit4 APIs? ERXTestCase extends junit.framework.TestCase which has the old prescribed method names like setUp(). I'm trying to work to JUnit4, using the @Before, @BeforeClass, @Test annotations, and so on. Or doesn't it matter?
>
> The actual inheritance isn't really that important, only that Wonder / EOF is initialised correctly, which ERXTestCase does for you.
I tried this, but kept hitting hurdles. (What's the constructor taking a String all about? I needed to use the EC supplied by editingContext() inside static methods, and already had my own static version of that method.)
>>> The problem I was having seemed to stem from the model somehow being unsuccessfully loaded twice, how this happened, or why the failures were unpredictable I didn't have the time to determine.
Turns out this was my problem as well. After making my superclass's setUp() method meticulous about not trying to load an already-loaded model, the issue went away.
--
Paul.
w http://logicsquad.net/
h http://paul.hoadley.name/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden