I am currently trying to repair some old tests (which I did not
even write myself) based on AbstractWicketTest and WicketTester.
At the moment all tests derived from AbstractWicketTest or using
TestNGWicketTester fail with some exception inside Wicket.
Since I am rather unfamiliar with the wicket test infrastructure,
I'd like to ask here, if the stuff below rings any bell with
anyone of you? Did I forget something fundamental? A missing
RequestCycle seems rather fundamental to me, i.e. I'd expect
the testing infrastructure to take care that there is one, or
am I mistaken here?
The one based on AbstractWicketTest basically tries to render a
page and check for some exception etc., it's code is rather
simplish:
| public void testRender( final FeedbackFormSpec formSpec ) {
| this.tester.startPage( new FeedbackFormSpecEditorTestPage( formSpec )
);
| this.tester.assertRenderedPage( FeedbackFormSpecEditorTestPage.class );
| this.tester.dumpPage();
| }
I get this stacktrace:
org.apache.wicket.WicketRuntimeException: No RequestCycle is currently set!
org.apache.wicket.Component.getRequest(Component.java:1803)
org.apache.wicket.markup.html.WebPage.dirty(WebPage.java:318)
org.apache.wicket.Page.dirty(Page.java:249)
org.apache.wicket.Page.componentStateChanging(Page.java:926)
org.apache.wicket.Component.addStateChange(Component.java:3527)
org.apache.wicket.Behaviors.add(Behaviors.java:55)
org.apache.wicket.Component.add(Component.java:4511)
com.mycompany.request.WicketContainerChecker.onInstantiation(WicketContainerChecker.java:48)
org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38)
org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34)
org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80)
org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33)
org.apache.wicket.Component.<init>(Component.java:683)
org.apache.wicket.MarkupContainer.<init>(MarkupContainer.java:121)
org.apache.wicket.Page.<init>(Page.java:168)
org.apache.wicket.Page.<init>(Page.java:132)
org.apache.wicket.markup.html.WebPage.<init>(WebPage.java:76)
com.mycompany.ui.components.types.FeedbackFormSpecEditorTestPage.<init>(FeedbackFormSpecEditorTestPage.java:38)
com.mycompany.ui.components.types.FeedbackFormSpecEditorTest.testAddingAndSwitchingFields(FeedbackFormSpecEditorTest.java:80)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
org.testng.TestRunner.privateRun(TestRunner.java:767)
org.testng.TestRunner.run(TestRunner.java:617)
org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
org.testng.SuiteRunner.run(SuiteRunner.java:240)
org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
org.testng.TestNG.runSuitesSequentially(TestNG.java:1198)
org.testng.TestNG.runSuitesLocally(TestNG.java:1123)
org.testng.TestNG.run(TestNG.java:1031)
org.testng.TestNG.privateMain(TestNG.java:1338)
org.testng.TestNG.main(TestNG.java:1307)
Cheers,
M'bert
--
----------- / http://herbert.the-little-red-haired-girl.org / -------------
=+=
I now declare this bizarre open!
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]