Hi Magnus,

> -----Original Message-----
> From: Magnus Mickelsson [mailto:[EMAIL PROTECTED]
> Sent: 02 September 2003 18:46
> To: Cactus Users List
> Subject: Always execute a end method on the client-side?
> 
> Hi guys,
> first off - sorry for the spam mail. I was too tired whan I read the
> message. (DOH!)
> 
> Now to my point. I sent this to the list before, but was for some
reason
> refused by the moderator. Here goes again (this thing is really
important
> to
> me, so I'd be really grateful for any hints :-)
> ------
> 
> I just wanted to know if there is some way to guarantee that either
the
> end(WebResponse) or endXXX(WebResponse) method in Cactus 1.5 is always
> executed (or similar functionality), regardless of assertion failure
or
> exceptions?

Not in the current sources. I don't think it would be a good idea. The
reason is that endXXX is used to assert the HTTP response and there
won't be any if the test has failed on the server side and thus for sure
the assert will fail, and it will mask the original error....

> 
> My problem is that I set up test data using DBUnit on the client in
the
> begin(WebRequest) method, and then want to clean it up after the test
has
> run, regardless of it has failed or not. I do not want the DBUnit
JARs,
> test-data etc. transported to the server unless I absolutely _have
to_. :-
> )

On that point, my belief is that database cleaning should not be done as
it is a waste of time. Why not better set up the database in the correct
state *before* each test? This prevents side effects and is inline with
the unit testing methodology which says that all tests are independent.
It's also clearer for a reader as he will know what data needs to be set
before the test.

Anyway, that wasn't your question... ;-)

Back to your problem. If you still want to do cleanup, you should do
that in a tearDown() method, which is the recommended place (one
advantage is that you can benefit from the container's connection pool).

> 
> Any ideas?

Thanks
-Vincent



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to