Here is how you test wizards:
        // check that buttons main view and feedback panel exists for wizard
        tester.assertComponent("myWizard:form:" + Wizard.VIEW_ID,
Component.class);
        tester.assertComponent("myWizard:form:" + Wizard.BUTTONS_ID,
WizardButtonBar.class);
        tester.assertComponent("myWizard:form:" + Wizard.FEEDBACK_ID,
FeedbackPanel.class);

        // navigating to the next wizard page by submitting the next button
        String nextFullBtnPath = "myWizard:form:" + Wizard.BUTTONS_ID +
":next";
        tester.assertComponent(nextFullBtnPath, WizardButton.class);

        WizardButton nextButton = (WizardButton)
tester.getComponentFromLastRenderedPage(nextFullBtnPath);
        nextButton.onSubmit();

        // assert myDemoPanel is displayed
        tester.assertComponent("myWizard:form:view:myDemoPanel",
DemoPanel.class);



romand wrote:
> 
> 
> cruiserdude wrote:
>> 
>> Hi,
>> 
>> Bit of a noob question but I was hoping somebody might be able to give an
>> example of unit testing a Wizard, I'm not entirely sure how to test the
>> individual pages. 
>> 
>> So far I've got to the point that I can check that my child of
>> Wizard.class has rendered but every time I try and check that a
>> particular component has been rendered I get "Path xx.xx.xx does not
>> exist for page : WizardPage
>> 
>> I have googled and searched the forum but I haven't been able to come up
>> with much. Any suggestions or examples would be most appreciated.
>> 
>> Thanks
>> cruiserdude
>> 
> 
> If you are asking for org.apache.wicket.extensions.wizard.Wizard
> 
> it may be caused because your components are nested inside other
> containers in the Wizard class so you have to go through the whole
> hierarchy. For example:
> 
> "YourWizard:form:view:yourComponent"
> 
> try this code:
> 
> WicketTester wt = new WicketTester();
> wt.startPage(YourPage.class);
> WebMarkupContainer container = (WebMarkupContainer)
> wt.getComponentFromLastRenderedPage("YourWizardStringId:form:view");
> 
> Iterator it = container.iterator();
> while (it.hasNext()) {
>     System.out.println(it.next());
> }
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Unit-testing-wizards-tp12123025p16470099.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to