views:

26

answers:

1

Hi all, I'm trying to use StrutsTestCase for testing my Struts2 actions, but I'm getting always the "error" value back while executing the "execute()" method from the proxy. Here's the example:

public void testSpike() throws Exception{

    request.addHeader("param1", "param");

    ActionProxy proxy = getActionProxy("/action/to/test.action");
    assertNotNull(proxy);

    TestAction action = (TestAction) proxy.getAction();
    assertNotNull(action);

    String output = proxy.execute();

}

the output string is always "error". Is there a way to understand what happened there? The logs are not saying anything, and even trying to debug placing a breakpoint on the Action class doesn't help (the code never stops there).

Any suggestions?

Thanks Roberto

A: 

Add a breakpoint at the line 'String output = proxy.execute();'. Execute your test in debug mode in your favorite IDE and step through the code to realize why execute() method returns always 'error'.

Boris Pavlović