struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ed Griebel" <edgrie...@gmail.com>
Subject Re: StrutsTestCases
Date Thu, 27 Apr 2006 14:08:03 GMT
There was a question about this a couple of days ago where web.xml was
not being found. Also, it looks like you have a leading slash before
the "D:" in  setConfigFile(), that could be the problem.

HTH
-ed

On 4/27/06, Chaitanya Parkhi <struts.cdp@gmail.com> wrote:
> hi friends i m working on  Struts Test Cases ,i have written the following
> code,for testing accurate user login from login page for my application i
> hav included strutsTest-2.1.3.jar,junit.jar from JUNIT_HOME directory,when i
> run the following code i m getting following failures:
>
> 1.junit.framework.AssertionFailedError: The /WEB-INF/web.xml was not found.
> 2.junit.framework.AssertionFailedError: No tests found in
> servletunit.struts.MockStrutsTestCase
>
> can anybody plz tell me whats a problem? is ther anything reqd to write in
> web.xml for StrutstestCases?................
>
>
> import servletunit.struts.MockStrutsTestCase;
>
> public class TestLoginAction extends MockStrutsTestCase {
>
>     public void setUp() throws Exception
>     {
>     super.setUp();
>     }
>
>     public void tearDown() throws Exception
>     {
>     super.tearDown();
>     }
>
>     public TestLoginAction(String testName)
>     {
>     super(testName);
>     }
>
>
>     public void testSuccessfulLogin() {
>
>
>  setConfigFile("/D:/Projects/Silk-Server/Phase2-RTQA1-Branch/SilkMobileServerWeb/WebRoot/WEB-INF/config/struts-
> config.xml");
>
>
>      setRequestPathInfo("/login");
>         addRequestParameter("username","cdpadmin");
>         addRequestParameter("password","cdp");
>
>
>         actionPerform();
>
>         String[] actionErrors = {"username.required","password.required"};
>     verifyActionErrors(actionErrors);
>
>
>      }
>
>     public void testFailedLogin() {
>
>         addRequestParameter("username","cdpadmin");
>         addRequestParameter("password","indiana");
>         setRequestPathInfo("/login");
>         actionPerform();
>
>
>         verifyTilesForward("success","success.tiles.def");
>
>         verifyActionErrors(new String[] {"error.password.mismatch","
> error.username.required","error.password.required"});
>         }
>
> }
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message