You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Alec Swan <al...@gmail.com> on 2012/09/04 20:11:44 UTC

Migration to 1.5: BaseWicketTester#startPanel

Hello,

Now that most of my production code is migrated to 1.5 I started
migrating my tests. The first problem I ran into is with
BaseWicketTester#startPanel and
BaseWicketTester#getComponentFromLastRenderedPage.

In 1.4 I could use startPanel and then find components with
getComponentFromLastRenderedPage using paths relative to the panel. In
1.5 I need to prefix those paths with "panel:". Adding this prefix in
hundreds of tests is overwhelming.

BaseWicketTester#startComponentInPage(Class) JavaDoc says that it can
use RELATIVE paths to look up components, but this is not the case for
BaseWicketTester#startComponentInPage(Component)! That's because the
method with Class parameter sets ComponentInPage#isInstantiated flag
which is then checked in getComponentFromLastRenderedPage. I think all
overloaded startComponentInPage methods should do that.

Is this a bug?

Thanks,

Alec

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Migration to 1.5: BaseWicketTester#startPanel

Posted by Alec Swan <al...@gmail.com>.
Thanks for the info. I hope there are plans to clean up WicketTester
because the simplicity of testing Wicket components that it provides
is a very important Wicket feature.

Alec

On Tue, Sep 4, 2012 at 1:46 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> we migrated from 1.4.x to 1.5.x. but, we use selenium to test ui
> instead of wicket tester :)
>
> -igor
>
> On Tue, Sep 4, 2012 at 12:07 PM, Alec Swan <al...@gmail.com> wrote:
>> This makes me wonder how many big apps actually migrated from 1.4 to
>> 1.5 (instead of starting from scratch) if this problem has never been
>> discovered. I also noticed that getComponentFromLastRenderedPage
>> assumes that the id of the instantiated component is different from
>> the id of it's first child (if (path.startsWith(componentIdPageId) ==
>> false { path = componentIdPageId + path;} ) This feels kludgy.
>>
>> I will follow your recommendation but I think this code should be refactored.
>>
>> Thanks,
>>
>> Alec
>>
>>
>> On Tue, Sep 4, 2012 at 12:25 PM, Martin Grigorov <mg...@apache.org> wrote:
>>> Hi,
>>>
>>> Even if there is a place for improvement it is too late now.
>>> There are many apps in production with 1.5 at that time and this
>>> change will break them.
>>> You can extend WicketTester and override the problematic method to
>>> behave as you need it.
>>>
>>> On Tue, Sep 4, 2012 at 8:11 PM, Alec Swan <al...@gmail.com> wrote:
>>>> Hello,
>>>>
>>>> Now that most of my production code is migrated to 1.5 I started
>>>> migrating my tests. The first problem I ran into is with
>>>> BaseWicketTester#startPanel and
>>>> BaseWicketTester#getComponentFromLastRenderedPage.
>>>>
>>>> In 1.4 I could use startPanel and then find components with
>>>> getComponentFromLastRenderedPage using paths relative to the panel. In
>>>> 1.5 I need to prefix those paths with "panel:". Adding this prefix in
>>>> hundreds of tests is overwhelming.
>>>>
>>>> BaseWicketTester#startComponentInPage(Class) JavaDoc says that it can
>>>> use RELATIVE paths to look up components, but this is not the case for
>>>> BaseWicketTester#startComponentInPage(Component)! That's because the
>>>> method with Class parameter sets ComponentInPage#isInstantiated flag
>>>> which is then checked in getComponentFromLastRenderedPage. I think all
>>>> overloaded startComponentInPage methods should do that.
>>>>
>>>> Is this a bug?
>>>>
>>>> Thanks,
>>>>
>>>> Alec
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>>
>>> --
>>> Martin Grigorov
>>> jWeekend
>>> Training, Consulting, Development
>>> http://jWeekend.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Migration to 1.5: BaseWicketTester#startPanel

Posted by Igor Vaynberg <ig...@gmail.com>.
we migrated from 1.4.x to 1.5.x. but, we use selenium to test ui
instead of wicket tester :)

-igor

On Tue, Sep 4, 2012 at 12:07 PM, Alec Swan <al...@gmail.com> wrote:
> This makes me wonder how many big apps actually migrated from 1.4 to
> 1.5 (instead of starting from scratch) if this problem has never been
> discovered. I also noticed that getComponentFromLastRenderedPage
> assumes that the id of the instantiated component is different from
> the id of it's first child (if (path.startsWith(componentIdPageId) ==
> false { path = componentIdPageId + path;} ) This feels kludgy.
>
> I will follow your recommendation but I think this code should be refactored.
>
> Thanks,
>
> Alec
>
>
> On Tue, Sep 4, 2012 at 12:25 PM, Martin Grigorov <mg...@apache.org> wrote:
>> Hi,
>>
>> Even if there is a place for improvement it is too late now.
>> There are many apps in production with 1.5 at that time and this
>> change will break them.
>> You can extend WicketTester and override the problematic method to
>> behave as you need it.
>>
>> On Tue, Sep 4, 2012 at 8:11 PM, Alec Swan <al...@gmail.com> wrote:
>>> Hello,
>>>
>>> Now that most of my production code is migrated to 1.5 I started
>>> migrating my tests. The first problem I ran into is with
>>> BaseWicketTester#startPanel and
>>> BaseWicketTester#getComponentFromLastRenderedPage.
>>>
>>> In 1.4 I could use startPanel and then find components with
>>> getComponentFromLastRenderedPage using paths relative to the panel. In
>>> 1.5 I need to prefix those paths with "panel:". Adding this prefix in
>>> hundreds of tests is overwhelming.
>>>
>>> BaseWicketTester#startComponentInPage(Class) JavaDoc says that it can
>>> use RELATIVE paths to look up components, but this is not the case for
>>> BaseWicketTester#startComponentInPage(Component)! That's because the
>>> method with Class parameter sets ComponentInPage#isInstantiated flag
>>> which is then checked in getComponentFromLastRenderedPage. I think all
>>> overloaded startComponentInPage methods should do that.
>>>
>>> Is this a bug?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Migration to 1.5: BaseWicketTester#startPanel

Posted by Paul Bors <pa...@bors.ws>.
Not quite, pre 1.5.x you kinda had to handle the WicketTester in your own
way anyhow as it was notorious for its "gotcha"'s.

We've migrated from 1.3.7 to 1.5.7 and since we extended WicketTester our
unit tests still behave as we expect them since we have our own API wrapping
around Wicket's. Refactoring was straight forward and it took a single
engineer a few days to get the app ported over.

The webapp we are maintaining has a good 800+ Java pages, panels and
reusable components and is meant to be used as an Administrative tool for
our products including some reporting.

~ Thank you,
  Paul Bors

-----Original Message-----
From: Alec Swan [mailto:alecswan@gmail.com] 
Sent: Tuesday, September 04, 2012 3:08 PM
To: users@wicket.apache.org
Subject: Re: Migration to 1.5: BaseWicketTester#startPanel

This makes me wonder how many big apps actually migrated from 1.4 to
1.5 (instead of starting from scratch) if this problem has never been
discovered. I also noticed that getComponentFromLastRenderedPage assumes
that the id of the instantiated component is different from the id of it's
first child (if (path.startsWith(componentIdPageId) == false { path =
componentIdPageId + path;} ) This feels kludgy.

I will follow your recommendation but I think this code should be
refactored.

Thanks,

Alec


On Tue, Sep 4, 2012 at 12:25 PM, Martin Grigorov <mg...@apache.org>
wrote:
> Hi,
>
> Even if there is a place for improvement it is too late now.
> There are many apps in production with 1.5 at that time and this 
> change will break them.
> You can extend WicketTester and override the problematic method to 
> behave as you need it.
>
> On Tue, Sep 4, 2012 at 8:11 PM, Alec Swan <al...@gmail.com> wrote:
>> Hello,
>>
>> Now that most of my production code is migrated to 1.5 I started 
>> migrating my tests. The first problem I ran into is with 
>> BaseWicketTester#startPanel and 
>> BaseWicketTester#getComponentFromLastRenderedPage.
>>
>> In 1.4 I could use startPanel and then find components with 
>> getComponentFromLastRenderedPage using paths relative to the panel. 
>> In
>> 1.5 I need to prefix those paths with "panel:". Adding this prefix in 
>> hundreds of tests is overwhelming.
>>
>> BaseWicketTester#startComponentInPage(Class) JavaDoc says that it can 
>> use RELATIVE paths to look up components, but this is not the case 
>> for BaseWicketTester#startComponentInPage(Component)! That's because 
>> the method with Class parameter sets ComponentInPage#isInstantiated 
>> flag which is then checked in getComponentFromLastRenderedPage. I 
>> think all overloaded startComponentInPage methods should do that.
>>
>> Is this a bug?
>>
>> Thanks,
>>
>> Alec
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Migration to 1.5: BaseWicketTester#startPanel

Posted by Alec Swan <al...@gmail.com>.
This makes me wonder how many big apps actually migrated from 1.4 to
1.5 (instead of starting from scratch) if this problem has never been
discovered. I also noticed that getComponentFromLastRenderedPage
assumes that the id of the instantiated component is different from
the id of it's first child (if (path.startsWith(componentIdPageId) ==
false { path = componentIdPageId + path;} ) This feels kludgy.

I will follow your recommendation but I think this code should be refactored.

Thanks,

Alec


On Tue, Sep 4, 2012 at 12:25 PM, Martin Grigorov <mg...@apache.org> wrote:
> Hi,
>
> Even if there is a place for improvement it is too late now.
> There are many apps in production with 1.5 at that time and this
> change will break them.
> You can extend WicketTester and override the problematic method to
> behave as you need it.
>
> On Tue, Sep 4, 2012 at 8:11 PM, Alec Swan <al...@gmail.com> wrote:
>> Hello,
>>
>> Now that most of my production code is migrated to 1.5 I started
>> migrating my tests. The first problem I ran into is with
>> BaseWicketTester#startPanel and
>> BaseWicketTester#getComponentFromLastRenderedPage.
>>
>> In 1.4 I could use startPanel and then find components with
>> getComponentFromLastRenderedPage using paths relative to the panel. In
>> 1.5 I need to prefix those paths with "panel:". Adding this prefix in
>> hundreds of tests is overwhelming.
>>
>> BaseWicketTester#startComponentInPage(Class) JavaDoc says that it can
>> use RELATIVE paths to look up components, but this is not the case for
>> BaseWicketTester#startComponentInPage(Component)! That's because the
>> method with Class parameter sets ComponentInPage#isInstantiated flag
>> which is then checked in getComponentFromLastRenderedPage. I think all
>> overloaded startComponentInPage methods should do that.
>>
>> Is this a bug?
>>
>> Thanks,
>>
>> Alec
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Migration to 1.5: BaseWicketTester#startPanel

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

Even if there is a place for improvement it is too late now.
There are many apps in production with 1.5 at that time and this
change will break them.
You can extend WicketTester and override the problematic method to
behave as you need it.

On Tue, Sep 4, 2012 at 8:11 PM, Alec Swan <al...@gmail.com> wrote:
> Hello,
>
> Now that most of my production code is migrated to 1.5 I started
> migrating my tests. The first problem I ran into is with
> BaseWicketTester#startPanel and
> BaseWicketTester#getComponentFromLastRenderedPage.
>
> In 1.4 I could use startPanel and then find components with
> getComponentFromLastRenderedPage using paths relative to the panel. In
> 1.5 I need to prefix those paths with "panel:". Adding this prefix in
> hundreds of tests is overwhelming.
>
> BaseWicketTester#startComponentInPage(Class) JavaDoc says that it can
> use RELATIVE paths to look up components, but this is not the case for
> BaseWicketTester#startComponentInPage(Component)! That's because the
> method with Class parameter sets ComponentInPage#isInstantiated flag
> which is then checked in getComponentFromLastRenderedPage. I think all
> overloaded startComponentInPage methods should do that.
>
> Is this a bug?
>
> Thanks,
>
> Alec
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org