Return-Path: list-help: list-unsubscribe: List-Post: List-Id: Mailing-List: contact cactus-user-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list cactus-user@jakarta.apache.org Received: (qmail 22716 invoked from network); 3 Sep 2003 20:34:45 -0000 Received: from unknown (HELO smtp.noos.fr) (212.198.2.82) by daedalus.apache.org with SMTP; 3 Sep 2003 20:34:45 -0000 Received: (qmail 139591001 invoked by uid 0); 3 Sep 2003 20:08:07 -0000 Received: from unknown (HELO vma) ([212.198.6.189]) (envelope-sender ) by 212.198.2.82 (qmail-ldap-1.03) with SMTP for ; 3 Sep 2003 20:08:07 -0000 From: "Vincent Massol" To: "'Cactus Users List'" Subject: RE: RE : Always execute a end method on the client-side? Date: Wed, 3 Sep 2003 22:07:44 +0200 Message-ID: <01d501c37257$0a8ab6d0$b495fd0a@vma> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4024 In-Reply-To: <6FAE40314DD0D4119AF200508BDE743203BD84F4@hydrus-exch.fr.eu.corp.vizzavi.net> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N > -----Original Message----- > From: BRUNOT S=E9bastien [mailto:sebastien.brunot.prestataire@cegetel.fr] > Sent: 03 September 2003 09:49 > To: 'Cactus Users List' > Subject: RE : Always execute a end method on the client-side? >=20 > >> > >> 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_. :- > >> ) >=20 > >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. >=20 > I think that database cleaning after each test is a good thing to do : as > a > unit test doesn't know wich test was run before it, it has to clean the > entire database and then set up the entire database if the cleaning is > done > in the setUp() method... If you perform the cleaning at the end of the > test, > you just have to clean the data you generated during test execution. It > might save a lot of time, especially if you intend to run the same tests > under different database load conditions ! >=20 > Some real life experiences on the subject ? (or maybe we should follow up > the thread on a more "generalist" unit testing mailing list ?) If you want to apply your strategy you'll need to setup the whole database at least once before all the tests run (possibly in a TestSetup's setUp() method). Now, it all depends on how coarse-grained are your tests. If you're doing functional testing calling and thus testing code that calls and touches several tables you may find that you have a complex setup to do. However, if you're talking about unit testing, I've found that my code under test only tests one or a few tables only and the setup is both easy and fast. I guess it also depends on how complex your database model is. -Vincent