jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Novotny <novo...@aei.mpg.de>
Subject testing and subclassing
Date Tue, 09 Sep 2003 15:41:30 GMT

Hi,

    I'm trying to use Cactus/Junit to test my scenario. I have one test 
that simply just checks that it can instantiate and init my servlet 
object. The next test then would use this method in its setUp() method 
before testing methods for trying to log a root user in from the 
database. Next I need a TestSetupUsers class that woudl then subclass to 
use the initialization of the base test and the testLoginRootUser test 
of the SetupRootUserTest. So what I tried doing initially was something 
like this:

    MyServletTest
      
          testInitServlet()

    TestSetupRoot extends MyServletTest
      
          setUp() {
             // uses super.testInitServlet()
          }
   
          testLoginRotUser()

    TestSetupUsers extends TestSetupRoot

       setUp() {
          // uses super.setUp()and super.testInitServlet()
       }
   
       testCreateUsers()

Now, I look thru and I see these tests are no good because of the 
subclassing. The TestSetupUsers is also testing all the test* methods of 
the superclasses. I feel like what I'm doing must be somewhat common to 
other projects-- I would be very interested in any discussions of how to 
make unit testing dependencies manageable.

    Thanks, Jason

      


Mime
View raw message