Hi Chris,
From what I understand, your ServiceTest and UserTest classes are, in fact, Cactus tests, i.e., they extend ServletTestCase or some other Cactus base class. I  am actually trying to re-use plain non-cactus JUnit test cases. Basically, I want to be able to run my  tests on the client and on the server without changing them (I use system property to switch between two modes).
So far (before 1.5), I've been extending ServletTestCase and overriding runBare and runTest methods of org.junit.TestCase which seems to do the trick. But I was hoping that I could come up with more elegant solution using wrapped tests supported by Cactus 1.5.
I just looked at the source code and verified that runBareServerTest() calls  setUp/tearDown on the wrapping Cactus test as opposed to the wrapped plain JUnit test. Perhaps it's by design (after all setUp/tearDown are protected), I'm not sure.
 
Thanks,
Alexander
----- Original Message -----
Sent: Friday, August 22, 2003 4:31 AM
Subject: Re: setUp does not run with ServletTestSuite


Hi!

That is how we implement a suite ... and it works fine:

package com....usermanagement.cactus;

import org.apache.cactus.ServletTestCase;

import junit.framework.Test;
import junit.framework.TestSuite;


public class AllCactusTests extends ServletTestCase {
       
        public AllCactusTests(String theName) {
                super(theName);
        }
       
        public static Test suite() {
                TestSuite suite =
                        new TestSuite("Test for com....usermanagement.cactus");
                //$JUnit-BEGIN$
                suite.addTestSuite(UserManagementTest.class);
        suite.addTestSuite(ServiceTest.class);
        suite.addTestSuite(UserTest.class);
       
                //$JUnit-END$
                return suite;
        }
}

Hope this helps,
Chris.

Reply via email to