Re: Very simple Wicket test to verify panel type...

2012-02-10 Thread Bjørn Grønbæk
Hi Hans and Martin.

The dump and debugComponentTrees was exactly what I was looking for. My
pages inherit from other pages, which of course made my panels have id's
like: topcontainer:subcontainer:panelid.

I'll check out the other tools as well.

Thanks alot.

BG

On 10 February 2012 08:54, Martin Grigorov mgrigo...@apache.org wrote:

 Hi

 One way to see the component paths is:
 org.apache.wicket.util.tester.BaseWicketTester#debugComponentTrees

 Another way is by using DebugBar from wicket-devutils. At
 http://www.wicket-library.com/wicket-examples/forminput , in the
 top-right corner there is a link Inspector, click it and it will
 show you more info, check Page section.

 On Thu, Feb 9, 2012 at 10:59 PM, Bjørn Grønbæk
 bjorn.gronb...@endomondo.com wrote:
  Hi,
 
  I'm just starting out with Wicket and WicketTester...
 
  I have a page that adds one of several panels, depending of its
  PageParameter. I would like to verify that behaviour with WicketTester...
  but how to?
 
  The code is something like this:
 
 String type = null;
 Panel p = null;
 
 if(getPageParameters() != null)
 type = getPageParameters().getString(BRAND_TYPE);
 
 if(type != null  type.equals(BRAND))
 p = new PanelA(id);
 else
 p = new PanelB(id);
  add(p);
 
  I've tried something like this:
 
  wicketTester.startPage(CreatePage.class);
  wicketTester.assertRenderedPage(CreatePage.class);
  wicketTester.assertComponent(:panelid,PanelA.class);
 
  but that doesn't work. The test fails with this message:
  junit.framework.AssertionFailedError: component 'CreatePage' is not
  type:PanelA
 
  Am I using the AssertComponent in a wrong way?
  How else can I perform a test like that?
  Could you point me to a good resource on how I find the path to
 components?
 
 
  --
 
  Best Regard
 
  Bjørn Grønbæk
 
  Software Engineer
 
  m: bjorn.gronb...@endomondo.com first%20name.last%20n...@endomondo.com
  p: +45 22669501
  w: *www.endomondo.com* http://www.endomondo.com/
  t: *www.twitter.com/endomondo* http://www.twitter.com/endomondo
  f:* **www.facebook.com/endomondo* http://www.facebook.com/endomondo
  e: www.endomondo.com/profile/406738 
 http://www.endomondo.com/profile/your



 --
 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




-- 

Best Regard

Bjørn Grønbæk

Software Engineer

m: bjorn.gronb...@endomondo.com first%20name.last%20n...@endomondo.com
p: +45 22669501
w: *www.endomondo.com* http://www.endomondo.com/
t: *www.twitter.com/endomondo* http://www.twitter.com/endomondo
f:* **www.facebook.com/endomondo* http://www.facebook.com/endomondo
e: www.endomondo.com/profile/406738 http://www.endomondo.com/profile/your


Very simple Wicket test to verify panel type...

2012-02-09 Thread Bjørn Grønbæk
Hi,

I'm just starting out with Wicket and WicketTester...

I have a page that adds one of several panels, depending of its
PageParameter. I would like to verify that behaviour with WicketTester...
but how to?

The code is something like this:

String type = null;
Panel p = null;

if(getPageParameters() != null)
type = getPageParameters().getString(BRAND_TYPE);

if(type != null  type.equals(BRAND))
p = new PanelA(id);
else
p = new PanelB(id);
 add(p);

I've tried something like this:

wicketTester.startPage(CreatePage.class);
wicketTester.assertRenderedPage(CreatePage.class);
wicketTester.assertComponent(:panelid,PanelA.class);

but that doesn't work. The test fails with this message:
junit.framework.AssertionFailedError: component 'CreatePage' is not
type:PanelA

Am I using the AssertComponent in a wrong way?
How else can I perform a test like that?
Could you point me to a good resource on how I find the path to components?


-- 

Best Regard

Bjørn Grønbæk

Software Engineer

m: bjorn.gronb...@endomondo.com first%20name.last%20n...@endomondo.com
p: +45 22669501
w: *www.endomondo.com* http://www.endomondo.com/
t: *www.twitter.com/endomondo* http://www.twitter.com/endomondo
f:* **www.facebook.com/endomondo* http://www.facebook.com/endomondo
e: www.endomondo.com/profile/406738 http://www.endomondo.com/profile/your