Hi Harsha, Please reply to the JWebUnit users list.
We can't help you any further without more information. What were the results of your debugging? Were the text fields being set? Did the page content change at all when submitting the form? Perhaps this will help you resolve the problem. Cheers Jevon On Thu, Mar 15, 2012 at 8:04 PM, Harsha Puttaswamy <harsha_puttasw...@isoty.com> wrote: > Hi there, > > > > I appreciate your reply in short period of time, > > > > Yes I tried debugging with the specified method. > > No, I am not using AJAX for login. I am using .xhtml > > > > Thanks and Regards, > > > > Harsha Puttaswamy > > From: soundasl...@gmail.com [mailto:soundasl...@gmail.com] On Behalf Of > Jevon Wright > Sent: Thursday, March 15, 2012 1:39 AM > To: Harsha Puttaswamy > Cc: jwebunit-development-ow...@lists.sourceforge.net > Subject: Re: Need help for LoginFailureTestCase scenario. > > > > Hi Harsha, > > Have you tried debugging the page by using methods such as getPageSource()? > > Are you using AJAX for login? You might need to set the > NicelyResynchronizingAjaxController. > > > Cheers > > > > On Thu, Mar 15, 2012 at 3:08 AM, Harsha Puttaswamy > <harsha_puttasw...@isoty.com> wrote: > > Hi, > > > > I am using JWebUnit for a week now. I have struck in writing test case > responsible to find out login fail. > > For this I want to track the “Login failed” message displayed on the web > page. > > > > Problem : I am calling login action in my login.xhtml page. Seam security > renders messages by org.jboss.security.identity class. > > --------------------------------------------------- > > Code: > > package com.isoty.mnpJUnit.action; > > > > import net.sourceforge.jwebunit.junit.WebTester; > > > > import org.junit.AfterClass; > > import org.junit.Before; > > import org.junit.Test; > > > > public class JWebUnitTestTest{ > > > > WebTester tester; > > > > @Before > > public void setUp(){ > > > > tester = new WebTester(); > > tester.setBaseUrl("http://localhost:8080/mnpJUnit"); //Setting > up the base url where the home page is rendered > > } > > @Test > > public void testLoginFailureTest() { > > > > tester.beginAt("/login.seam"); //Begin the operation > on http://localhost:8080/mnpJUnit/login.seam > > tester.assertTitleEquals("mnpJUnit"); // we should be on the login > page, but the page name we have given as mnpJUnit > > > > // fill out the form > > tester.assertLinkNotPresent("Logout"); // we should not be logged > in > > tester.assertFormPresent("loginForm"); //The form name > > tester.assertFormElementPresent("loginForm:username"); > > tester.assertFormElementPresent("loginForm:password"); > > tester.setTextField("loginForm:username", "xyz"); > > tester.setTextField("loginForm:password", "1234"); > > tester.submit(); > > tester.assertMatch("Login failed"); //Here, at this point the test > is failing. Since the message is rendered by calling action class, it is not > able to track this failed message from current page. > > > > } > > --------------------------------------------- > > Log: > > > > java.lang.AssertionError: Expected rexexp not matched in response: [Login > failed] > > at org.junit.Assert.fail(Assert.java:93) > > at > net.sourceforge.jwebunit.junit.WebTester.assertMatch(WebTester.java:520) > > at > com.isoty.mnpJUnit.action.JWebUnitTestTest.tearDown(JWebUnitTestTest.java:63) > > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown > Source) > > at java.lang.reflect.Method.invoke(Unknown Source) > > at > org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) > > at > org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) > > at > org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) > > at > org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:36) > > at org.junit.runners.ParentRunner.run(ParentRunner.java:300) > > at > org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49) > > at > org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) > > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) > > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) > > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) > > at > org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) > > > > > > > > Thanks and Regards, > > Harsha Puttaswamy > > > > iSoty Software Services Pvt Ltd. > > #Incubation Center 3, SJCE-STEP. > JSS Technical Institutions, SJCE Campus. > Mysore, KARNATAKA, INDIA. > PIN -570006 > > > > ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure _______________________________________________ JWebUnit-users mailing list JWebUnit-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jwebunit-users