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 Re: testing and subclassing
Date Tue, 09 Sep 2003 16:34:02 GMT

Hi Vinent,

    Thanks for the response-- I guess what I'm asking is how can I reuse 
test code from one test as a fixture for another test in my test suite?
   
    Thanks, Jason

Vincent Massol wrote:

>Jason,
>
>I don't think I quite understand. In any case:
>
>- if you want to group test together, you should use a junit test suite
>(see the junit website)
>- each test must be independent of the other. Only the fixture can be
>shared through setUp. Tests that share the same fixture are grouped
>together in a TestCase
>
>-Vincent
>
>  
>
>>-----Original Message-----
>>From: Jason Novotny [mailto:novotny@aei.mpg.de]
>>Sent: 09 September 2003 17:42
>>To: cactus-user@jakarta.apache.org
>>Subject: testing and subclassing
>>
>>
>>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
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>>    
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>
>  
>



Mime
View raw message