Re: WicketTester - Problem submitting a form

2009-02-01 Thread Timo Rantalaiho
On Wed, 28 Jan 2009, Stephan Koch wrote:
 mountBookmarkablePage(/login, LoginPage.class);
 
 When I remove that line, the test runs fine. Could be a bug in
 WicketTester? I'd like some opinions on that before I file a JIRA issue.

It could be, but you could still try replacing

  tester.startPage(LoginPage.class);

with tester.starPage(new TestPageSource() { ... });

If you can add a failing quickstart or a patch containing a 
failing test, it would be great.

Best wishes,
Timo

-- 
Timo Rantalaiho   
Reaktor Innovations OyURL: http://www.ri.fi/ 

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: WicketTester - Problem submitting a form

2009-01-28 Thread Stephan Koch
Hi Per,

I tried that before, still the same exception. From what I read using
clickLink() on the SubmitLink or doing submit() should do the same.

Per Newgro wrote:
 Hi Stephan Koch,
 
 i can't help you on the exception. But all i can see is that you don't
 call submit.
 
 FormTester loginFormTester = tester.newFormTester(form);
 loginFormTester.setValue(loginName, testUser.getUsername());
 loginFormTester.setValue(password, test);
 loginFormTester.submit(); //  insert
 tester.clickLink(form:loginSubmit);
 
 But give it a try. I always have strange exceptions if i call methods
 invalidly.
 
 Cheers
 Per
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Re: WicketTester - Problem submitting a form

2009-01-28 Thread Stephan Koch
Hi all,

the exception is apparently caused by mounting the LoginPage. In my
Application init(), I do this:

mountBookmarkablePage(/login, LoginPage.class);

When I remove that line, the test runs fine. Could be a bug in
WicketTester? I'd like some opinions on that before I file a JIRA issue.

I'm using Wicket 1.3.5.

-stephan


Stephan Koch wrote:
 Hi all,
 
 I ran into a problem with WicketTester. I am doing a very simple test of
 the login form of my application:
 
 code
 .. setup stuff ...
 
 tester.startPage(LoginPage.class);
 tester.assertComponent(form:loginName, TextField.class);
 FormTester loginFormTester = tester.newFormTester(form);
 loginFormTester.setValue(loginName, testUser.getUsername());
 loginFormTester.setValue(password, test);
 tester.clickLink(form:loginSubmit);
 tester.assertRenderedPage(DashboardPage.class);
 
 /code
 
 The form is a standard wicket form object with 1 Textfield, 1
 PasswordTextField for username and password, 2 buttons that use
 SubmitLinks, and a FeedbackPanel.
 
 I get the following error when submitting the form. I have no idea where
 that '/' comes from, but its obviously causing the problem.
 I also tried to use formtester.submit(loginSubmit) with the same results.
 
 Any suggestions?
 
 
 
 BR,
 Stephan
 
 org.apache.wicket.WicketRuntimeException: Internal error parsing
 wicket:interface = :0:form::IFormSubmitListener::/; wrong format for url
 depth argument. Expected a number but was '/'
   at
 org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.addInterfaceParameters(WebRequestCodingStrategy.java:617)
   at
 org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.addInterfaceParameters(WebRequestCodingStrategy.java:554)
   at
 org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.decode(WebRequestCodingStrategy.java:199)
   at org.apache.wicket.Request.getRequestParameters(Request.java:171)
   at org.apache.wicket.RequestCycle.step(RequestCycle.java:1233)
   at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1353)
   at org.apache.wicket.RequestCycle.request(RequestCycle.java:493)
   at
 org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:484)
   at
 org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:472)
   at
 org.apache.wicket.util.tester.BaseWicketTester.executeListener(BaseWicketTester.java:248)
   at
 org.apache.wicket.util.tester.BaseWicketTester.submitForm(BaseWicketTester.java:791)
   at
 org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:741)
   at
 org.apache.wicket.util.tester.BaseWicketTester.clickLink(BaseWicketTester.java:617)
   at
 com.xxx.xxx.wicket.pages.AllPagesInstantiationTest.testAllPagesFromMainMenu(AllPagesInstantiationTest.java:41)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at
 sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at
 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at junit.framework.TestCase.runTest(TestCase.java:154)
   at junit.framework.TestCase.runBare(TestCase.java:127)
   at
 org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
   at junit.framework.TestResult$1.protect(TestResult.java:106)
   at junit.framework.TestResult.runProtected(TestResult.java:124)
   at junit.framework.TestResult.run(TestResult.java:109)
   at junit.framework.TestCase.run(TestCase.java:118)
   at
 org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
   at
 org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
   at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
   at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
   at
 org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
 Caused by: java.lang.NumberFormatException: For input string: /
   at
 java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
   at java.lang.Integer.parseInt(Integer.java:447)
   at java.lang.Integer.parseInt(Integer.java:497)
   at
 org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.addInterfaceParameters(WebRequestCodingStrategy.java:613)
   ... 30 more
 
 
 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org
 


-
To unsubscribe, e-mail: 

Re: WicketTester - Problem submitting a form

2009-01-27 Thread Per Newgro

Hi Stephan Koch,

i can't help you on the exception. But all i can see is that you don't 
call submit.


FormTester loginFormTester = tester.newFormTester(form);
loginFormTester.setValue(loginName, testUser.getUsername());
loginFormTester.setValue(password, test);
loginFormTester.submit(); //  insert
tester.clickLink(form:loginSubmit);

But give it a try. I always have strange exceptions if i call methods 
invalidly.


Cheers
Per

-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org