jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@pivolis.com>
Subject RE: setUp and TearDown for specific Test Cases
Date Mon, 15 Sep 2003 21:54:41 GMT
Raj,

TestClass1 extends TestCase (or ServletTestCase or whatever)
{
protected void setUp()
{
[...]
}

public void test1()
{
[...]
}

public void test3()
{
[...]
}

public void test5()
{
[...]
}
}


TestClass2 extends TestCase (or ServletTestCase or whatever)
{
protected void setUp()
{
[...]
}

public void test2()
{
[...]
}

[...]
}

However, for general JUnit questions, please use the Junit mailing list
(you'll get better answers there). Unless I don't understand your
questions... ;-)

Thanks
-Vincent

> -----Original Message-----
> From: Rajagopal. V [mailto:raja0576@yahoo.com]
> Sent: 15 September 2003 23:32
> To: Cactus Users List
> Subject: RE: setUp and TearDown for specific Test Cases
> 
> Hi Vincent
> Sorry if i dint get you right, but i want some
> pre-conditions to be established before i run my test.
> 
> If i create these preconditions as test cases, i dont
> have a guarantee that they wud be run before my actual
> test cases, right?
> I want to make the preconditions run first and then
> the actual test cases.
> 
> Thanks
> Raj
> 
> --- Vincent Massol <vmassol@pivolis.com> wrote:
> >
> >
> > > -----Original Message-----
> > > From: Rajagopal. V [mailto:raja0576@yahoo.com]
> > > Sent: 15 September 2003 23:15
> > > To: cactus-user@jakarta.apache.org
> > > Subject: setUp and TearDown for specific Test
> > Cases
> > >
> > > Is there any way you can write a testcase specific
> > > Setup and TearDown method? the setup and tearDown
> > are
> > > run for every single testcase , if i need to have
> > some
> > > setup and teardown for testcases 1, 3 and 5, how
> > would
> > > i go about it.
> >
> > Easy. Simply create different test cases! JUnit
> > tests must be structured
> > around their fixture, i.e. have a different test
> > case per fixture.
> >
> > So in your case, you'll have one test case for tests
> > 1, 3 and 5 and
> > another test case for the other tests.
> >
> > -Vincent
> >
> > > For e.g. i need to create a few entities before i
> > > invoke a test. Yeah, i can write this in my
> > beginXXX
> > > and endXXX but if i use this, i cannot use any
> > > container specific APIs or i would need to add
> > > jndi.properties or the like to my cactus war(as
> > they
> > > would not be run in the client).
> > > So is there any way like a setupXXX and
> > tearDownXXX
> > > that will be invoked before and after testXXX?
> > >
> > > TIA
> > > Raj


Mime
View raw message