You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by an...@yahoo.fr on 2005/03/03 13:13:35 UTC

Still having problems

Hi, I'm still unable to understand what happen... 

To make it short, using my test suite I can see :

- that 2 client instances are created, and 1 server instance ((I thought I should be one 
server and ONE client)
- that endXXX is called TWICE on the server side (instead of client side)
- that on the second endXXX call wr.getText() return an empty string
- that no cookie is able to be read, nor on the client endXXX neither on the server 
testXXX

As I'm a new Cactus user I really don't know how to go further.

To know which instance is called I just use a int static member incremented by the 
constructor.

Here is a part of my testclass source code and the log produced :

The test suite is run by Cactus's ServletTestRunner - the whole stuff is under Tomcat 
5.0.28

I really need some help... Thank you

### TestMessageForm class

public class TestMessageForm extends TestCommon
{
    public void beginGenerateFormAddMessage(WebRequest wr)
    {       
        setupAuthCommonParameters(wr);
        log.debug("Client - beginGenerateFormAddMessage - " + instCounter);
        wr.addParameter("module","blog");
        wr.addParameter("action","addmsg");
        wr.addCookie("superid","99");
    }
    
    public void endGenerateFormAddMessage(WebResponse wr)
    {
        log.debug("Client - endGenerateFormAddMessage - " + instCounter);
        
        if(wr.getText().length() > 0)
        {
	        HtmlInspector checker = new HtmlInspector(wr.getText());
	        FormTag form = 
(FormTag)checker.findFirstNodeOfType(FormTag.class);
	        assertNotNull(checker.getChildElement(form,"postback"));
	        TagNode f;
	        
assertTrue(checker.getChildElement(form,"action").getAttribute("value").equalsIgnore
Case("addmsg"));
        }
        else log.debug("Client - Vide");
        
        log.debug("Client - Cookie = " + wr.getCookie("superid"));
    }
    
    public void testGenerateFormAddMessage() throws Exception
    {
        log.debug("Server - Empty test - " + instCounter);
        
        Cookie[] cookies = request.getCookies();
        log.debug("Server - Cookies = " + cookies);                      
        servletRun();
    }    
}

### Logs

13:06:47,500 DEBUG      TestCommon:  40 - Client - beginGenerateFormAddMessage - 1
13:06:47,500 DEBUG      TestCommon:  40 - Client - beginGenerateFormAddMessage - 2
13:06:47,515 DEBUG      TestCommon:  76 - Server - Empty test - 3
13:06:47,515 DEBUG      TestCommon:  79 - Server - Cookies = null
13:06:48,296 DEBUG      TestCommon:  89 - Server - Run AnaemServlet
13:06:51,437 DEBUG      TestCommon:  55 - Client - endGenerateFormAddMessage - 3
13:06:51,687 DEBUG      TestCommon:  71 - Client - Cookie = null
13:06:51,703 DEBUG      TestCommon:  55 - Client - endGenerateFormAddMessage - 3
13:06:51,703 DEBUG      TestCommon:  69 - Client - Vide
13:06:51,703 DEBUG      TestCommon:  71 - Client - Cookie = null