Hi Romain,

In article <[EMAIL PROTECTED]>,
Thu, 04 Aug 2005 09:17:10 +0200,
Romain Thouvenin <[EMAIL PROTECTED]> wrote: 
rthouvenin> That is what I thought, but according to the debug messages I print 
in 
rthouvenin> the beginXXX method, it is not already called when the program 
enter in 
rthouvenin> setUp in server-side.
rthouvenin> Could it be a problem of synchronizing ?

This may depending on how your TestSuite is created.

By the way, I made a working example.
Does this sample show what you want to do?

Regards,
----
Kazuhito SUGURI
import junit.framework.Test;
import org.apache.cactus.ServletTestCase;
import org.apache.cactus.ServletTestSuite;
import org.apache.cactus.WebRequest;

public class SampleTest
    extends ServletTestCase
{
    private static final String HTTP_PARAM_FOR_TESTCASE = "private_param_info";

    private String param;

    public SampleTest(String theName)
    {
        super(theName);
    }

    public SampleTest(String theName, String theParam)
    {
        this(theName);
        this.param = new String(theParam);
    }

    public void setUp()
    {
        String paramStr = request.getParameter(HTTP_PARAM_FOR_TESTCASE);
        this.param = new String(paramStr);
    }

    public void begin(WebRequest theRequest)
    {
        theRequest.addParameter(HTTP_PARAM_FOR_TESTCASE, this.param);
    }

    public void testSample()
    {
        assertEquals("hello world", this.param);
    }

    public static Test suite()
    {
        ServletTestSuite suite = new ServletTestSuite();
        suite.addTest(new SampleTest("testSample", "hello world"));
        return suite;
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to