As you're doing integration tests, I think this sounds good...

-Vincent

> -----Original Message-----
> From: Cumbers [mailto:[EMAIL PROTECTED]
> Sent: dimanche 16 janvier 2005 13:42
> To: Cactus Users List
> Subject: Re: Define order of tests
> 
> Hey Vince,
> 
> Thanks for the reply, I clean forgot about the JUnit Suite feature!
> 
> As for the reason for defining the order of tests, my logic is as follows:
> 
> I have a package of classes that retrieves data from the data base, for
> this explanation call that class CompanyAction.java This retrieves data
> based using a variety of SQL statements, depending on the method call. I
> test this by having known data in a database, and so through my
> assumptions that the data will not change (Only I have the password) I
> can assertEquals() that the data I retrieve from the database is correct
> and therefore the class is working correctly.
> 
> I also have a package of classes that inserts/updates data into the
> database, say CompanyStorer.java This class does exactly as you would
> expect, inserts new data, and updates existing data. I create Company
> data to insert and invoke the relevant method. Now here comes my
> reasoning for defining the order of tests:
> 
> If I run the CompanyActionTest class first, this gives me proof that the
> class CompanyAction works as expected within my system. If I
> subsequently run the CompanyStorerTest class I could in theory use the
> CompanyAction class to retrieve the inserted data, knowing that it
> functions correctly.
> 
> Of course I could just use my JNDI datasource within the test class and
> execute an SQL statement to get the same data, but I figured that as I
> can verify that CompanyAction works as expected it is best to use that.
> 
> So now I have filled in a little bit on what I want to do, would you say
> that I have a valid case for defining an order, or would you go with
> using my JNDI datasource in each test case to determine if data in the
> database is as expected?
> 
> Cheers
> 
> Rich
> 
> Vincent Massol wrote:
> > Hi Rich,
> >
> > Just use the Suite feature of JUnit. See the JUnit FAQ.
> >
> > Basically you create a suite in a static suite() method and add the
> tests
> > you wish to the suite, in the order you wish to execute them.
> >
> > All that said, it's not good to have any order (tests should be
> independent
> > of each other) and I don't understand why you absolutely need one. You
> could
> > use a fixture instead, ensuring that each tests has a correct setup
> before
> > it runs.
> >
> > Thanks
> > -Vincent
> >
> >
> >>-----Original Message-----
> >>From: Cumbers [mailto:[EMAIL PROTECTED]
> >>Sent: vendredi 14 janvier 2005 19:00
> >>To: Cactus Users List
> >>Subject: Define order of tests
> >>
> >>Hey guys
> >>
> >>I have a need to specify the order in which the tests for cactus are
> >>executed as one class I have defines retrieving data from the database,
> >>and another class defines storing data to the database. I would like the
> >>class that retrieves data to be run first, allowing this class to be
> >>'verified' as returning the correctly requested data. Then I would like
> >>to run the 'storing' class and then as a test of that use the
> >>'retrieving' class to verify that the stored data was indeed stored. I
> >>am using ant integration if that is on any assistance.
> >>
> >>Cheers
> >>
> >>Rich
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]





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

Reply via email to