Nice. The wicket id of the parent component (in this case 'advancedSearch') needs to be prepended along with a ':' as you said. The following returned without errors:

tester.assertComponent("advancedSearch:feedbackPanel", FeedbackPanel.class);

Thanks, again Martijn!

On May 27, 2008, at 12:29 PM, Martijn Dashorst wrote:

check the code for WicketTester, I thought the ID for the panel would
be "test", but could be "panel" or something else. Apparently my
memory sucks

Martijn

On Tue, May 27, 2008 at 6:24 PM, Ryan O'Hara <[EMAIL PROTECTED]> wrote:
Hey Martijn,

I've tried the following:

tester.assertComponent("test:feedbackPanel", FeedbackPanel.class);

However, I got:

org.apache.wicket.WicketRuntimeException: path: 'test:feedbackPanel'
does not exist for page: AdvancedSearch
       at
org.apache.wicket.util.tester.BaseWicketTester.fail (BaseWicketTester.java:1341)

Any ideas?

Thx again,
Ryan

On May 27, 2008, at 10:33 AM, Martijn Dashorst wrote:

testing a panel separately will cause wicket tester to add the panel
to a test page with component id "test". you can then test the panel
by asserting things like assertLabel("test:mycomponentid", "hello,
world"); etc.

Martijn

On Tue, May 27, 2008 at 4:18 PM, Ryan O'Hara <[EMAIL PROTECTED]>
wrote:

Thx for the response, Maurice.  I have been able to run tests on
components
added to the page. However, when I try to test the FeedbackPanel (which
is
added to the Form not the page) below using WicketTester, I get an error
about Wicket not finding that component.  I thought matching the
hierarchy
might do the trick, but there are no methods in formTester to test the
FeebackPanel.  Thanks again for the help.

Ryan

On May 25, 2008, at 1:56 PM, Maurice Marrink wrote:

An easy way would be to check them against the expected html output.
See for example WicketTestCase#assertResultPage

Maurice

On Fri, May 23, 2008 at 7:56 PM, Ryan O'Hara <[EMAIL PROTECTED]>
wrote:

Hello,

I'm trying to test a component that is added to another component that
is
added to the page. For example, I'd like to test the FeedbackPanel
below
that is added to the Form which is added to the page. I'm unsure of
how
to
do this.  Any help would be appreciated.  Thanks!

Ryan


public AdvancedSearch() {
     add(new TabbedHeader("advancedSearchTabbedHeader"));
     Form form = new Form("advancedSearch", new
CompoundPropertyModel(this));
     add(form);

     //feedbackPanel
FeedbackPanel feedbackPanel = new FeedbackPanel ("feedbackPanel");
     feedbackPanel.add(new AttributeModifier("class", true, new
Model("feedbackPanel")));
feedbackPanel.setFilter(new ContainerFeedbackMessageFilter (form));
     form.add(feedbackPanel);

public void testDisplayAdvancedSearch(){
     //create a tester and go to acknowledgements
WicketTester tester = new WicketTester(new CnvApplication ());
     tester.startPage(AdvancedSearch.class);

//check to make sure all components exist with correct names and
types
     tester.assertComponent("advancedSearchTabbedHeader",
TabbedHeader.class);
FormTester formTester = tester.newFormTester ("advancedSearch");
     //*****tester.assertComponent("feedbackPanel",
FeedbackPanel.class);

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



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




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





--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3

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




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





--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3

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




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

Reply via email to