> In the projects I have worked on we have used helper Path objects for
> testing which describe how to find a child of a given Component.
> In first sight it looks like we are duplicating the component tree and
> this is almost true but it helps a lot for such kind of problems
> because the Path helper hides these details from you and if you change
> something in the original component hierarchy then you need to
> fix only the related Path object and all your tests work again.
> Otherwise you have to fix the component path in all tests where you
> use it.

I'm also experiencing this, after making changes to the hierarchy inside a 
component unit tests start to fail because component paths have changed. 

Your suggestions looks interesting and would solve this problem. 


> 
> Another approach is to use MarkupContainer#visitChildren() + IVisitFilter.
> In your example:
> VisitorHelper.getComponentPath(form, "firstname", TextField.class)
> i.e. the helper will find the single child with type TextField and id
> "firstName" down in the hierarchy. From there on is easy to recreate
> the component path back to the root (the form in this case).
> 
> The second approach sounds good enough for me to be included in WicketTester
> ...
> 
> On Thu, Feb 23, 2012 at 1:05 PM, Schlärmann, Bob
> <bob.schlarm...@logica.com> wrote:
> > Hi list,
> >
> > I have a form with components each contained within an individual border.
> When testing the form with FormTester I have to specify the full component id
> including the intermediate component id's added by the border. Is there any
> easier way to do this, e.g. with wildcard paths or something?
> >
> > For example with a form like:
> >
> > <form wicket:id="form">
> > <div wicket:id="borderFirstname">
> >   <input type="input" wicket:id="firstname"/>
> > </div>
> > </form>
> >
> > The following id needs to be used for FormTester.setValue:
> >
> > "border.borderFirstname:border.borderFistname_body:firstname"
> >
> > Best regards,
> >
> > Bob
> >
> >
> > Think green - keep it on the screen.
> >
> > This e-mail and any attachment is for authorised use by the intended
> recipient(s) only. It may contain proprietary material, confidential
> information and/or be subject to legal privilege. It should not be copied,
> disclosed to, retained or used by, any other party. If you are not an intended
> recipient then please promptly delete this e-mail and any attachment and all
> copies and inform the sender. Thank you.
> >
> 
> 
> 
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


Think green - keep it on the screen.

This e-mail and any attachment is for authorised use by the intended 
recipient(s) only. It may contain proprietary material, confidential 
information and/or be subject to legal privilege. It should not be copied, 
disclosed to, retained or used by, any other party. If you are not an intended 
recipient then please promptly delete this e-mail and any attachment and all 
copies and inform the sender. Thank you.

Reply via email to