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). -Vincent > -----Original Message----- > From: Sean Zhang [mailto:[EMAIL PROTECTED]] > 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 case > class and wants to access its value from the server side (for example, to > see how many tests are in the test case), its value is reinitialized for > 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 class > is > instantiated for each testXXX() method? > > Thanks, > > Sean > > -- > To unsubscribe, e-mail: <mailto:cactus-user- > [EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:cactus-user- > [EMAIL PROTECTED]> > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
