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 "Chekutty, Kiran" <Ki...@Petrotechnics.com> on 2002/11/08 12:46:12 UTC
New Bie ............Can U Help Please?
Hi all,
I am new to Junit & Cactus. We have a Project entirely based on Struts Framework. And we are trying to write unit tests for the project. I know Junit tests are to be written first & not after the project is up in running. But we are planning for Version 2. Junit test would to good for atleast V2. I have read about StrutsTestCase in http://strutstestcase.sourceforge.net. I tried out an example using MockStrutsTestCase but couldn't succeed in getting through. So I thought I would try out Cactus approach for junit test I get the same exception as I got for Mock approach. This is my code
public class TestLogin extends CactusStrutsTestCase{
public TestLogin(String testName){
super(testName);
}
public void testSuccessfulLogin(){
setConfigFile("/WEB-INF/skyobma.xml");
setRequestPathInfo("/Login");
LoginFP inst=(LoginFP)getActionForm();
String pw = inst.getPassword();
String us = inst.getUserName();
addRequestParameter("username",us);
addRequestParameter("password",pw);
actionPerform();
verifyForwardPath("next");
verifyActionErrors(new String[] {"error.login.invalid_username"});
}
This is the Error I get.
1. java.lang.VerifyError: (class: servletunit/struts/Common, method: verifyNoActionErrors signature: (Ljavax/servlet/http/HttpServletRequest;)V) Incompatible object argument for function call
2. at servletunit.struts.MockStrutsTestCase.setRequestPathInfo(MockStrutsTestCase.java:312)
3. at servletunit.struts.MockStrutsTestCase.setRequestPathInfo(MockStrutsTestCase.java:293)
4. at com.petrotechnics.skyobma.test.login.event.TestLogin.testSuccessfulLogin(TestLogin.java:30)
5. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
6. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
7. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
May be I am doign something wrong.Can some guru help me...............................
Cheers
Kiran Chekutty
Petrotechnics Ltd.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>