On Sun, Jun 5, 2011 at 7:14 PM, Igor Vaynberg <[email protected]> wrote:
> On Sun, Jun 5, 2011 at 9:01 AM, Martin Grigorov <[email protected]> wrote:
>> Currently MockApplication overrides #internalInit() (why not #init()
>> ?!) and setups almost similar inmemory/mock impls like the ones
>> BaseWicketTester overrides later.
>
> it does, but it is a very common scenario when components under test
> need to access something in application or session which is why we
> tell the users to use their own application class with tester.
>
>> I find it confusing that in my app I have to use #init() {
>> setXYZProvider(...)} but in tests this provider is overridden silently
>> by something else.
>
> which provider is causing you grief specifically? these things are
> mostly wicket internals and transparent to the application. if you
> wanted to test them i doubt you would do it through the wickettester
> itself.

The first one was ISessionStore - I needed to use HttpSessionStore
(the default one) for WicketSessionFilterTest.
I had to rework BaseWicketTester to be able to actually setup
HttpSessionStore. See commit #1131149.

Today I needed to setup custom IPageManager and again I needed to
debug why it is ignored/overridden.
Looking at BaseWicketTester I see no other providers that override
silently. I just need to touch the one for IPageManager.

>
>> Using boolean flag for all providers doesn't seem OK to me. Maybe we
>> can provide BaseWicketTester#newXYZProvider() for all which can be
>> overridden and if this method returns 'null' then don't override. This
>> way the user can allow one inmemory impl but ignore another.
>
> either way works, as long as the default is not changed - eg tests run
> with in-memory store and run fast.
>
I agree with 'fast'. I just didn't like that it is not possible to run
with any other impl.

> -igor
>
>>
>> On Sun, Jun 5, 2011 at 6:46 PM, Igor Vaynberg <[email protected]> 
>> wrote:
>>> i think the memory/mock things should be there by default because they
>>> make the tests run faster. if you want to control it make it a boolean
>>> on the tester itself. putting this kind of logic into application
>>> class seems a little dirty.
>>>
>>> -igor
>>>
>>> On Sun, Jun 5, 2011 at 7:36 AM, Martin Grigorov <[email protected]> 
>>> wrote:
>>>> Hi,
>>>>
>>>> I had some troubles recently to setup custom ISessionStore and
>>>> IPageManager for some tests.
>>>> The problem is that BaseWicketTester overrides anything already setup
>>>> in MyApp#init() with the inmemory/mock impls.
>>>> I suggest to move all these inmemory/mock impls in
>>>> MockApplication#init() and all tests that use "new WicketTester()"
>>>> will use those. All user's tests will have to override UserApp#init()
>>>> for the tests if they prefer any inmemory/mock impl, otherwise they
>>>> will use the default impl provided by Wicket (depends on DEPLOYMENT or
>>>> DEVELOPMENT mode). This way they will be more close to the real
>>>> environment and can setup inmemory impl *only* if they decide so.
>>>>
>>>> The only exception are IPageRendererProvider and IRequestCycleProvider
>>>> which has to be special for WicketTester.
>>>>
>>>> WDYT ?
>>>>
>>>> --
>>>> Martin Grigorov
>>>> jWeekend
>>>> Training, Consulting, Development
>>>> http://jWeekend.com
>>>>
>>>
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>



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

Reply via email to