jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vincent Massol" <vmas...@octo.com>
Subject RE: Class variable in test case class loses its value
Date Thu, 17 Jan 2002 22:33:04 GMT
It is a feature of JUnit. In order for each test to be ran independently
of another, JUnit uses a custom classloader. So, for each test case, the
test case class is reloaded.

You have 2 options :
- do not use static variables (recommended way)
- there is a JUnit flag to turn of the classloading stuff (see the JUnit
doc as I don't know the flag).


> -----Original Message-----
> From: Sean Zhang [mailto:sean.zhang@verizon.com]
> Sent: 17 January 2002 22:09
> To: Cactus Users List
> Subject: Class variable in test case class loses its value
> Hi,
> I noticed that if I declare a class variable (a counter) in the test
> class and wants to access its value from the server side (for example,
> see how many tests are in the test case), its value is reinitialized
> each testXXX I have.  Is it because for each testXXX() method I have,
> there
> is a round trip from client --> server --> client and the test case
> is
> instantiated for each testXXX() method?
> Thanks,
> Sean
> --
> To unsubscribe, e-mail:   <mailto:cactus-user-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:cactus-user-
> help@jakarta.apache.org>

To unsubscribe, e-mail:   <mailto:cactus-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:cactus-user-help@jakarta.apache.org>

View raw message