I haven't used the "verifyForwardPath()" method in StrutsTestCase, but I am
using it with StrutsTestCase and yep, it works fine for me.

-----Original Message-----
From: Sachin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 06, 2003 3:10 AM
To: Struts Users Mailing List (E-mail)
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Is StrutsTestcase is working for Struts1.1..????


Hi Daniel,
            I have start learning TestCase for Struts by using
StrutsTestCase.for this i have used example comes with distribution.It works
fine with Cactus based Approach both on Client side and In Container.

Now when i have replced perform() (Deprecated..) with execute() in Action.I
start getting problem in testCase so can anyone suggest me.

What changes need to be done in your example to run for Struts1.1...

It works fine with struts1.0 but give follwoing error when used with
Struts1.1

Configuration is same as for Struts1.0..

Thanks
Sachin

Here is Error..

.F.F
Time: 2.297
There were 2 failures:
1)
testSuccessfulLogin(examples.cactus.TestCactusLoginAction)junit.framework.As
sertionFailedError: Was expecting '/testStruts/main/success.jsp' but it
appears the Action has tried to return an ActionForward that is not mapped
correctly.
        at servletunit.struts.Common.verifyForwardPath(Common.java:164)
        at
servletunit.struts.CactusStrutsTestCase.verifyForward(CactusStrutsTestCase.j
ava:537)
        at
examples.cactus.TestCactusLoginAction.testSuccessfulLogin(TestCactusLoginAct
ion.java:33)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
        at
org.apache.cactus.AbstractTestCase.runServerTest(AbstractTestCase.java:332)
        at
org.apache.cactus.AbstractTestCase.runBareServerTest(AbstractTestCase.java:2
35)
        at
org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.
java:149)
        at
org.apache.cactus.server.AbstractWebTestController.dispatch87_handleRequest(
AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj(1k):1
25)
        at
org.apache.cactus.server.AbstractWebTestController.around87_handleRequest(Ab
stractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj(1k):115
6)
        at
org.apache.cactus.server.AbstractWebTestController.handleRequest(AbstractWeb
TestController.java;org/apache/cactus/util/log/LogAspect.aj(1k):101)
        at
org.apache.cactus.server.ServletTestRedirector.dispatch113_doPost(ServletTes
tRedirector.java;org/apache/cactus/util/log/LogAspect.aj(1k):123)
        at
org.apache.cactus.server.ServletTestRedirector.around113_doPost(ServletTestR
edirector.java;org/apache/cactus/util/log/LogAsp

My Code

package examples.cactus;

import servletunit.struts.CactusStrutsTestCase;

public class TestCactusLoginAction extends CactusStrutsTestCase {

    public TestCactusLoginAction(String testName) {
        super(testName);
    }

    public void testSuccessfulLogin() {

        addRequestParameter("username","deryl");
        addRequestParameter("password","radar");
        setRequestPathInfo("/login");
        actionPerform();
        verifyForward("success");
            verifyForwardPath("/main/success.jsp");
        assertEquals("deryl", getSession().getAttribute("authentication"));
        verifyNoActionErrors();
    }

    public void testFailedLogin() {

        addRequestParameter("username","deryl");
        addRequestParameter("password","express");
        setRequestPathInfo("/login");
        actionPerform();
        verifyForward("login");
            verifyForwardPath("/login/login.jsp");
            verifyInputForward();
        verifyActionErrors(new String[] {"error.password.mismatch"});
        assertNull(getSession().getAttribute("authentication"));
    }

    public static void main(String[] args) {
        junit.textui.TestRunner.run(TestCactusLoginAction.class);
    }

}





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

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

Reply via email to