Re: Wicket tester and jquery-ui dialog

2017-01-23 Thread Maxim Solodovnik
Hello All,

With the help of Sebastien I was able to create POC [1] [2] and was able to
test wicket-jquery-ui dialog using wicket tester
Hope this will be useful :)

[1] https://github.com/apache/openmeetings/blob/3.2.x/
openmeetings-web/src/test/java/org/apache/openmeetings/
test/AbstractWicketTester.java#L64
[2] https://github.com/apache/openmeetings/blob/3.2.x/
openmeetings-web/src/test/java/org/apache/openmeetings/
test/web/LoginUI.java#L70



On Mon, Jan 23, 2017 at 5:28 PM, Sebastien  wrote:

> Hi Maxim,
>
> The only related thread I found is a mail entitled "WicketTester and
> Wicket jQuery UI" on d...@openmeetings.apache.org (from 14/09/2013). I
> cannot find the markmail archive however...
> There is no crucial information though. I will forward it to you directly
> to not spam users@wicket. Please tell me if/when you ended with something
> useful! :)
>
> Thanks & best regards,
> Sebastien.
>
>
> On Mon, Jan 23, 2017 at 4:54 AM, Maxim Solodovnik 
> wrote:
>
>> Hello Sebastien,
>>
>> I do remember were there some questions on the topic, but unfortunately I
>> was unable to find the discussion,
>> Could you please tell me or maybe send a link to the example on how
>> wickek-jquery-ui dialog can be pressed using wicket tester?
>>
>> Thanks in advance!
>>
>> --
>> WBR
>> Maxim aka solomax
>>
>
>


-- 
WBR
Maxim aka solomax


Re: Wicket tester and jquery-ui dialog

2017-01-23 Thread Sebastien
Hi Maxim,

The only related thread I found is a mail entitled "WicketTester and Wicket
jQuery UI" on d...@openmeetings.apache.org (from 14/09/2013). I cannot find
the markmail archive however...
There is no crucial information though. I will forward it to you directly
to not spam users@wicket. Please tell me if/when you ended with something
useful! :)

Thanks & best regards,
Sebastien.

On Mon, Jan 23, 2017 at 4:54 AM, Maxim Solodovnik 
wrote:

> Hello Sebastien,
>
> I do remember were there some questions on the topic, but unfortunately I
> was unable to find the discussion,
> Could you please tell me or maybe send a link to the example on how
> wickek-jquery-ui dialog can be pressed using wicket tester?
>
> Thanks in advance!
>
> --
> WBR
> Maxim aka solomax
>


Wicket tester and jquery-ui dialog

2017-01-22 Thread Maxim Solodovnik
Hello Sebastien,

I do remember were there some questions on the topic, but unfortunately I
was unable to find the discussion,
Could you please tell me or maybe send a link to the example on how
wickek-jquery-ui dialog can be pressed using wicket tester?

Thanks in advance!

-- 
WBR
Maxim aka solomax


Re: Wicket tester and mounted resources

2016-08-09 Thread Martin Grigorov
Hi,

On Aug 9, 2016 10:45 AM, "giacomolm"  wrote:
>
> Hi Martin,
> thanks for your reply. As you confirmed, mounted resources are available
to
> the wicket tester instance.
>
> What if I want to expose again those endpoints outside the tester
> application?
>
> It would be great if wicket tester can re-expose such resources: on this
way
> I can interact with them using ajax requests. Of course an URL must exists
> for each mount point.

You could the correct url with lastRenderedPage.urlFor(TheResRef.class,
pageParameters). Then you can make a request with tester.executeUrl(...).

Is this what you need?

>
> --
> View this message in context:
http://apache-wicket.1842946.n4.nabble.com/Wicket-tester-and-mounted-resources-tp4675288p4675290.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>


Re: Wicket tester and mounted resources

2016-08-09 Thread giacomolm
Hi Martin,
thanks for your reply. As you confirmed, mounted resources are available to
the wicket tester instance.

What if I want to expose again those endpoints outside the tester
application?
 
It would be great if wicket tester can re-expose such resources: on this way
I can interact with them using ajax requests. Of course an URL must exists
for each mount point.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-tester-and-mounted-resources-tp4675288p4675290.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket tester and mounted resources

2016-08-08 Thread Martin Grigorov
Hi,

If you use YourApplication when creating the WicketTester then those
resources are already mounted for all your tests.
If you use (the default) MockApplication then you'll need to mount those
resource references with tester.getApplication().mountResource(...) when
needed.
Then you can use tester.startResourceReference(...) to make requests to
them.

On Aug 9, 2016 12:34 AM, "giacomolm"  wrote:

> Hi,
> I created a wicket application with some resources mounted during
> initialization. When I deploy the application in Tomcat, I can easily reach
> those endpoints.
>
> Now i'm creating some tests and I'm using wicket tester. When I run those
> tests, is there a way to reach those endpoints?
>
> From my understanding wicket tester doesn't need to deploy that
> application,
> but I need to reach some endpoints from a frontend application.
>
> --
> View this message in context: http://apache-wicket.1842946.
> n4.nabble.com/Wicket-tester-and-mounted-resources-tp4675288.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Wicket tester and mounted resources

2016-08-08 Thread giacomolm
Hi,
I created a wicket application with some resources mounted during
initialization. When I deploy the application in Tomcat, I can easily reach
those endpoints.

Now i'm creating some tests and I'm using wicket tester. When I run those
tests, is there a way to reach those endpoints?

>From my understanding wicket tester doesn't need to deploy that application,
but I need to reach some endpoints from a frontend application.

--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-tester-and-mounted-resources-tp4675288.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: How to set multi value in wicket tester

2015-11-06 Thread Maxim Solodovnik
My bad, sorry, search formTester for this :(
Thanks again!

On Fri, Nov 6, 2015 at 6:29 PM, Martin Grigorov 
wrote:

> How so?
> Your test creates the tester (WicketTester) and later uses it to create the
> FormTester: tester.newFormTester(...)
> So it is reachable
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Nov 6, 2015 at 1:26 PM, Maxim Solodovnik 
> wrote:
>
> > The only issue with this approach: tester is private :(
> >
> > On Fri, Nov 6, 2015 at 6:22 PM, Maxim Solodovnik 
> > wrote:
> >
> > > Great, thanks a lot!
> > >
> > > On Fri, Nov 6, 2015 at 6:21 PM, Martin Grigorov 
> > > wrote:
> > >
> > >> Hi Maxim,
> > >>
> > >> You can use
> > >> tester.getRequest().addParameter(select2.getInputName(), "CA")
> > >> tester.getRequest().addParameter(select2.getInputName(), "BE")
> > >>
> > >> Martin Grigorov
> > >> Wicket Training and Consulting
> > >> https://twitter.com/mtgrigorov
> > >>
> > >> On Fri, Nov 6, 2015 at 12:56 PM, Maxim Solodovnik <
> solomax...@gmail.com
> > >
> > >> wrote:
> > >>
> > >> > Actually I feel I need method like:
> > >> > formTester.setValue(page.country, new String[]{"CA","BE"});
> > >> >
> > >> > Maybe someone knows how this can be done/work-arounded?
> > >> >
> > >> > On Fri, Nov 6, 2015 at 5:36 PM, Maxim Solodovnik <
> > solomax...@gmail.com>
> > >> > wrote:
> > >> >
> > >> > > Hello All,
> > >> > >
> > >> > > I'm currently trying to write tests for Select2MultiChoice
> > wicketstuff
> > >> > > component.
> > >> > >
> > >> > > Previously there was an option to set multiple values like this:
> > >> > > formTester.setValue(page.country, "CA,BE");
> > >> > >
> > >> > > In previous version this component was based on HiddenField and
> > >> > everything
> > >> > > was working
> > >> > > In select2 4.0 the preferred way is to use  component
> > >> > > How can I set multiple values for select component in
> wickettester?
> > >> > > (I can't use *selectMultiple *due to option list is being opened
> on
> > >> > > component open only)
> > >> > >
> > >> > > --
> > >> > > WBR
> > >> > > Maxim aka solomax
> > >> > >
> > >> >
> > >> >
> > >> >
> > >> > --
> > >> > WBR
> > >> > Maxim aka solomax
> > >> >
> > >>
> > >
> > >
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax


Re: How to set multi value in wicket tester

2015-11-06 Thread Martin Grigorov
How so?
Your test creates the tester (WicketTester) and later uses it to create the
FormTester: tester.newFormTester(...)
So it is reachable

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Nov 6, 2015 at 1:26 PM, Maxim Solodovnik 
wrote:

> The only issue with this approach: tester is private :(
>
> On Fri, Nov 6, 2015 at 6:22 PM, Maxim Solodovnik 
> wrote:
>
> > Great, thanks a lot!
> >
> > On Fri, Nov 6, 2015 at 6:21 PM, Martin Grigorov 
> > wrote:
> >
> >> Hi Maxim,
> >>
> >> You can use
> >> tester.getRequest().addParameter(select2.getInputName(), "CA")
> >> tester.getRequest().addParameter(select2.getInputName(), "BE")
> >>
> >> Martin Grigorov
> >> Wicket Training and Consulting
> >> https://twitter.com/mtgrigorov
> >>
> >> On Fri, Nov 6, 2015 at 12:56 PM, Maxim Solodovnik  >
> >> wrote:
> >>
> >> > Actually I feel I need method like:
> >> > formTester.setValue(page.country, new String[]{"CA","BE"});
> >> >
> >> > Maybe someone knows how this can be done/work-arounded?
> >> >
> >> > On Fri, Nov 6, 2015 at 5:36 PM, Maxim Solodovnik <
> solomax...@gmail.com>
> >> > wrote:
> >> >
> >> > > Hello All,
> >> > >
> >> > > I'm currently trying to write tests for Select2MultiChoice
> wicketstuff
> >> > > component.
> >> > >
> >> > > Previously there was an option to set multiple values like this:
> >> > > formTester.setValue(page.country, "CA,BE");
> >> > >
> >> > > In previous version this component was based on HiddenField and
> >> > everything
> >> > > was working
> >> > > In select2 4.0 the preferred way is to use  component
> >> > > How can I set multiple values for select component in wickettester?
> >> > > (I can't use *selectMultiple *due to option list is being opened on
> >> > > component open only)
> >> > >
> >> > > --
> >> > > WBR
> >> > > Maxim aka solomax
> >> > >
> >> >
> >> >
> >> >
> >> > --
> >> > WBR
> >> > Maxim aka solomax
> >> >
> >>
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>


Re: How to set multi value in wicket tester

2015-11-06 Thread Maxim Solodovnik
The only issue with this approach: tester is private :(

On Fri, Nov 6, 2015 at 6:22 PM, Maxim Solodovnik 
wrote:

> Great, thanks a lot!
>
> On Fri, Nov 6, 2015 at 6:21 PM, Martin Grigorov 
> wrote:
>
>> Hi Maxim,
>>
>> You can use
>> tester.getRequest().addParameter(select2.getInputName(), "CA")
>> tester.getRequest().addParameter(select2.getInputName(), "BE")
>>
>> Martin Grigorov
>> Wicket Training and Consulting
>> https://twitter.com/mtgrigorov
>>
>> On Fri, Nov 6, 2015 at 12:56 PM, Maxim Solodovnik 
>> wrote:
>>
>> > Actually I feel I need method like:
>> > formTester.setValue(page.country, new String[]{"CA","BE"});
>> >
>> > Maybe someone knows how this can be done/work-arounded?
>> >
>> > On Fri, Nov 6, 2015 at 5:36 PM, Maxim Solodovnik 
>> > wrote:
>> >
>> > > Hello All,
>> > >
>> > > I'm currently trying to write tests for Select2MultiChoice wicketstuff
>> > > component.
>> > >
>> > > Previously there was an option to set multiple values like this:
>> > > formTester.setValue(page.country, "CA,BE");
>> > >
>> > > In previous version this component was based on HiddenField and
>> > everything
>> > > was working
>> > > In select2 4.0 the preferred way is to use  component
>> > > How can I set multiple values for select component in wickettester?
>> > > (I can't use *selectMultiple *due to option list is being opened on
>> > > component open only)
>> > >
>> > > --
>> > > WBR
>> > > Maxim aka solomax
>> > >
>> >
>> >
>> >
>> > --
>> > WBR
>> > Maxim aka solomax
>> >
>>
>
>
>
> --
> WBR
> Maxim aka solomax
>



-- 
WBR
Maxim aka solomax


Re: How to set multi value in wicket tester

2015-11-06 Thread Maxim Solodovnik
Great, thanks a lot!

On Fri, Nov 6, 2015 at 6:21 PM, Martin Grigorov 
wrote:

> Hi Maxim,
>
> You can use
> tester.getRequest().addParameter(select2.getInputName(), "CA")
> tester.getRequest().addParameter(select2.getInputName(), "BE")
>
> Martin Grigorov
> Wicket Training and Consulting
> https://twitter.com/mtgrigorov
>
> On Fri, Nov 6, 2015 at 12:56 PM, Maxim Solodovnik 
> wrote:
>
> > Actually I feel I need method like:
> > formTester.setValue(page.country, new String[]{"CA","BE"});
> >
> > Maybe someone knows how this can be done/work-arounded?
> >
> > On Fri, Nov 6, 2015 at 5:36 PM, Maxim Solodovnik 
> > wrote:
> >
> > > Hello All,
> > >
> > > I'm currently trying to write tests for Select2MultiChoice wicketstuff
> > > component.
> > >
> > > Previously there was an option to set multiple values like this:
> > > formTester.setValue(page.country, "CA,BE");
> > >
> > > In previous version this component was based on HiddenField and
> > everything
> > > was working
> > > In select2 4.0 the preferred way is to use  component
> > > How can I set multiple values for select component in wickettester?
> > > (I can't use *selectMultiple *due to option list is being opened on
> > > component open only)
> > >
> > > --
> > > WBR
> > > Maxim aka solomax
> > >
> >
> >
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>



-- 
WBR
Maxim aka solomax


Re: How to set multi value in wicket tester

2015-11-06 Thread Martin Grigorov
Hi Maxim,

You can use
tester.getRequest().addParameter(select2.getInputName(), "CA")
tester.getRequest().addParameter(select2.getInputName(), "BE")

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Nov 6, 2015 at 12:56 PM, Maxim Solodovnik 
wrote:

> Actually I feel I need method like:
> formTester.setValue(page.country, new String[]{"CA","BE"});
>
> Maybe someone knows how this can be done/work-arounded?
>
> On Fri, Nov 6, 2015 at 5:36 PM, Maxim Solodovnik 
> wrote:
>
> > Hello All,
> >
> > I'm currently trying to write tests for Select2MultiChoice wicketstuff
> > component.
> >
> > Previously there was an option to set multiple values like this:
> > formTester.setValue(page.country, "CA,BE");
> >
> > In previous version this component was based on HiddenField and
> everything
> > was working
> > In select2 4.0 the preferred way is to use  component
> > How can I set multiple values for select component in wickettester?
> > (I can't use *selectMultiple *due to option list is being opened on
> > component open only)
> >
> > --
> > WBR
> > Maxim aka solomax
> >
>
>
>
> --
> WBR
> Maxim aka solomax
>


Re: How to set multi value in wicket tester

2015-11-06 Thread Maxim Solodovnik
Actually I feel I need method like:
formTester.setValue(page.country, new String[]{"CA","BE"});

Maybe someone knows how this can be done/work-arounded?

On Fri, Nov 6, 2015 at 5:36 PM, Maxim Solodovnik 
wrote:

> Hello All,
>
> I'm currently trying to write tests for Select2MultiChoice wicketstuff
> component.
>
> Previously there was an option to set multiple values like this:
> formTester.setValue(page.country, "CA,BE");
>
> In previous version this component was based on HiddenField and everything
> was working
> In select2 4.0 the preferred way is to use  component
> How can I set multiple values for select component in wickettester?
> (I can't use *selectMultiple *due to option list is being opened on
> component open only)
>
> --
> WBR
> Maxim aka solomax
>



-- 
WBR
Maxim aka solomax


How to set multi value in wicket tester

2015-11-06 Thread Maxim Solodovnik
Hello All,

I'm currently trying to write tests for Select2MultiChoice wicketstuff
component.

Previously there was an option to set multiple values like this:
formTester.setValue(page.country, "CA,BE");

In previous version this component was based on HiddenField and everything
was working
In select2 4.0 the preferred way is to use  component
How can I set multiple values for select component in wickettester?
(I can't use *selectMultiple *due to option list is being opened on
component open only)

-- 
WBR
Maxim aka solomax


RE: Cannot set select2choice component in wicket tester

2015-10-01 Thread Lois GreeneHernandez
Thank you so much. 

Lois

-Original Message-
From: Martin Grigorov [mailto:mgrigo...@apache.org] 
Sent: Thursday, October 01, 2015 11:59 AM
To: users@wicket.apache.org
Subject: Re: Cannot set select2choice component in wicket tester

Hi,

Since Select2 is a JavaScript widget usually in WicketTester tests you just 
need to submit a value for it.
FormTester ft = tester.newFormTester("theForm"); 
ft.setValue("path:to:select2Choice", "selectedOptionValue"); ft.submit();



Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 1, 2015 at 7:44 AM, Lois GreeneHernandez < 
lgreenehernan...@knoa.com> wrote:

> Hello All,
>
> My form has a select2choice component.  I cannot seem to set this 
> field in my testing unit test.
>
> Any advice on how to deal with this would be greatly appreciated.
>
> Thanks
>
> Lois
>
>


Re: Cannot set select2choice component in wicket tester

2015-10-01 Thread Martin Grigorov
Hi,

Since Select2 is a JavaScript widget usually in WicketTester tests you just
need to submit a value for it.
FormTester ft = tester.newFormTester("theForm");
ft.setValue("path:to:select2Choice", "selectedOptionValue");
ft.submit();



Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Oct 1, 2015 at 7:44 AM, Lois GreeneHernandez <
lgreenehernan...@knoa.com> wrote:

> Hello All,
>
> My form has a select2choice component.  I cannot seem to set this field in
> my testing unit test.
>
> Any advice on how to deal with this would be greatly appreciated.
>
> Thanks
>
> Lois
>
>


Cannot set select2choice component in wicket tester

2015-09-30 Thread Lois GreeneHernandez
Hello All,

My form has a select2choice component.  I cannot seem to set this field in my 
testing unit test.

Any advice on how to deal with this would be greatly appreciated.

Thanks

Lois



Re: Wicket CDI 1.1 and Wicket Tester

2013-11-30 Thread Martin Grigorov
Hi,

There is a new experimental module that provides CdiWicketTester -
https://github.com/apache/wicket/blob/wicket-6.x/wicket-experimental/wicket-cdi-1.1/src/test/java/org/apache/wicket/cdi/CdiWicketTester.java
It's first release will be with Wicket 6.13.0

But as you can see CdiWicketTester is in src/test/ folder. Now is the time
to file a ticket and ask this file to be moved to src/java/, so you can use
it in your application as well ;-)


On Sat, Nov 30, 2013 at 5:23 PM, martin.dilger  wrote:

> I have a very simple testcase running, described here
>
> http://www.effectivetrainings.de/blog/2013/11/30/wicket-und-cdi-1-1-auf-den-richtigen-kontext-kommt-es-an/
> .
> But I´m pretty sure there must be an easier way.
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Wicket-CDI-1-1-and-Wicket-Tester-tp4662717p4662718.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


Re: Wicket CDI 1.1 and Wicket Tester

2013-11-30 Thread martin.dilger
I have a very simple testcase running, described here
http://www.effectivetrainings.de/blog/2013/11/30/wicket-und-cdi-1-1-auf-den-richtigen-kontext-kommt-es-an/.
But I´m pretty sure there must be an easier way.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-CDI-1-1-and-Wicket-Tester-tp4662717p4662718.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Wicket CDI 1.1 and Wicket Tester

2013-11-30 Thread martin.dilger
There are a couple of Posts but none that answers my Question.
How is a Unit Test for a Wicket CDI Application supposed to be written?
For the CDI Module itself there is CDIUnit from JGlue, but this does not
work 
for ApplicationTests as the Classes are not found and some are marked as
Package Private so that you cannot add them manually via @AdditionalClasses.
Is there a working example somewhere how to do that without using something
heavy like Arquillian?
Is this even possible?
Thanks for any hints.



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-CDI-1-1-and-Wicket-Tester-tp4662717.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket Tester with BookmarkablePageLink

2013-03-07 Thread yka
Thanks mate. Works fine now :)



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Tester-with-BookmarkablePageLink-tp4656921p4657091.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket Tester with BookmarkablePageLink

2013-03-06 Thread yka
Hi Vineet,
tried it out. My setup() method now looks like this:

@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
app = new StartApplication() {
@Override
public ServletContext getServletContext() {
ServletContext servletContext = 
super.getServletContext();
ApplicationContextMock appctx = new 
ApplicationContextMock();
Service service = Mockito.mock(Service.class);
appctx.putBean(service);
WebApplication application = new 
MockApplication();
WicketTester tester = new 
WicketTester(application);
SpringComponentInjector componentInjector = new 
SpringComponentInjector(
tester.getApplication(), 
appctx, false);


tester.getApplication().getComponentInstantiationListeners()
.add(componentInjector);

return servletContext;
}
};

org.apache.log4j.Logger logger = org.apache.log4j.Logger
.getLogger("org.apache.wicket.util.tester");
logger.setLevel(Level.DEBUG);

tester = new WicketTester(app);
}


But when I run the test, I get:

java.lang.IllegalStateException: No WebApplicationContext found: no
ContextLoaderListener registered?
at
org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:90)
at
org.apache.wicket.spring.injection.annot.SpringComponentInjector.(SpringComponentInjector.java:81)
at com.index.StartApplication.init(StartApplication.java:16)
at org.apache.wicket.Application.initApplication(Application.java:818)
at
org.apache.wicket.util.tester.BaseWicketTester.(BaseWicketTester.java:287)
at
org.apache.wicket.util.tester.BaseWicketTester.(BaseWicketTester.java:231)
at 
org.apache.wicket.util.tester.WicketTester.(WicketTester.java:184)
at
com.customer.web.AbstractBasePageTester.setUp(AbstractBasePageTester.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at
org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)
at 
org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Tester-with-BookmarkablePageLink-tp4656921p4657053.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Wicket Tester with BookmarkablePageLink

2013-03-04 Thread yka
Sure, this is the test code:

public class AbstractBasePageTester {
private WicketTester tester;

private StartApplication app;

@Mock
private CustomerService aService;

@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
app = new StartApplication() {
@Override
public ServletContext getServletContext() {
ServletContext servletContext = 
super.getServletContext();
XmlWebApplicationContext applicationContext = 
new
XmlWebApplicationContext();
applicationContext

.setConfigLocation("classpath:applicationContext.xml");

applicationContext.setServletContext(servletContext);
// applicationContext.refresh();
servletContext
.setAttribute(

WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,

applicationContext);

return servletContext;
}
};

org.apache.log4j.Logger logger = org.apache.log4j.Logger
.getLogger("org.apache.wicket.util.tester");
logger.setLevel(Level.DEBUG);

tester = new WicketTester(app);
}

@Test
public void homepageRendersSuccessfully() {
// start and render the test page
tester.startPage(Start.class);
tester.assertRenderedPage(Start.class);
tester.assertNoErrorMessage();
tester.debugComponentTrees();
tester.assertComponent("createCustomerLink", 
BookmarkablePageLink.class);
tester.assertComponent("showCustomersLink", 
BookmarkablePageLink.class);
tester.clickLink("createCustomerLink");
}

}



And this the normal code:
public class Start extends WebPage {

public Start() {
BookmarkablePageLink customerLink = new
BookmarkablePageLink(
"createCustomerLink", CreateCustomer.class);
customerLink.add(new Label("createCustomerLabel",
getString("createCustomerLabel")));
add(customerLink);
BookmarkablePageLink showCustomersLink = new
BookmarkablePageLink(
"showCustomersLink", ShowCustomers.class);
showCustomersLink.add(new Label("showCustomersLabel",
getString("showCustomersLabel")));
add(showCustomersLink);
}
}

public class StartApplication extends WebApplication {

@Override
public Class getHomePage() {
return Start.class;
}

@Override
protected void init() {
super.init();
SpringComponentInjector springComponentInjector = new
SpringComponentInjector(
this);

getComponentInstantiationListeners().add(springComponentInjector);

}

}



--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Tester-with-BookmarkablePageLink-tp4656921p4656954.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Wicket Tester with BookmarkablePageLink

2013-03-03 Thread yka
ink(BaseWicketTester.java:1875)
... 28 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:174)
... 45 more
Caused by: java.lang.IllegalStateException: BeanFactory not initialized or
already closed - call 'refresh' before accessing beans via the
ApplicationContext
at
org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:172)
at
org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:1174)
at
org.springframework.beans.factory.BeanFactoryUtils.beanNamesForTypeIncludingAncestors(BeanFactoryUtils.java:144)
at
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanNameOfClass(AnnotProxyFieldValueFactory.java:211)
at
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getBeanName(AnnotProxyFieldValueFactory.java:179)
at
org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:113)
at org.apache.wicket.injection.Injector.inject(Injector.java:111)
at
org.apache.wicket.spring.injection.annot.SpringComponentInjector.inject(SpringComponentInjector.java:127)
at
org.apache.wicket.spring.injection.annot.SpringComponentInjector.onInstantiation(SpringComponentInjector.java:133)
at
org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:38)
at
org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34)
at
org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80)
at
org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:33)
at org.apache.wicket.Component.(Component.java:683)
at org.apache.wicket.MarkupContainer.(MarkupContainer.java:120)
at org.apache.wicket.Page.(Page.java:172)
at org.apache.wicket.Page.(Page.java:136)
at org.apache.wicket.markup.html.WebPage.(WebPage.java:76)
at com.index.Start.(Start.java:12)
at com.customer.CreateCustomer.(CreateCustomer.java:24)
... 50 more




--
View this message in context: 
http://apache-wicket.1842946.n4.nabble.com/Wicket-Tester-with-BookmarkablePageLink-tp4656921.html
Sent from the Users forum mailing list archive at Nabble.com.

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



Re: Unable to use wicket tester to simulate ajax behavior

2012-07-24 Thread Giovanni Cuccu

Hi,
  here it is
https://issues.apache.org/jira/browse/WICKET-4670
Thanks,
  Giovanni

Il 24/07/12 09.22, Martin Grigorov ha scritto:

Hi,

File a ticket with a test case.

On Tue, Jul 24, 2012 at 9:34 AM, Giovanni Cuccu
 wrote:

Hi,
 sorry for the late response. Should I file a bug for this?
Thanks,
 Giovanni
Il 11/07/12 15.13, Giovanni Cuccu ha scritto:


Hi Martin,
  I did the change you suggested but the test fails with esame error:

junit.framework.AssertionFailedError: expect no error message, but
contains
Field 'combo1' is required.

Thanks,
  Giovanni
Il 11/07/12 09.23, Martin Grigorov ha scritto:

Hi,

Try with:

tester.getRequest().setParameter("form:combo1", "0");
tester.executeAjaxEvent("form:combo1", "onchange");

On Tue, Jul 10, 2012 at 10:10 AM, Giovanni Cuccu
 wrote:

Hi,
  can someone give me an hint on this?
I tried to explain my problem providing a complete example and
explaining
what I was trying to achieve.
I'd like to know if there is a specific reason of getting no answer so I
can
change something on my side the next time I need to write to the list.
Thanks,
  Giovanni
Il 05/07/12 08.10, Giovanni Cuccu ha scritto:


Hi all,
  I'm trying to test a wicket 1.5.7 application and I'm hitting a
strange (at least for me) issue.
I have two dropdowns (combo 1 and combo2) and when I select one value
from combo1 I fire an AjaxUpdateBehavior on onchange event which
selects
a value on combo2.
If I use the application everything is working as expected but If I try
to simulate the application with wicket tester I come into trouble.
Basically the test code is the following one:

  WicketTester tester= new WicketTester(new
WicketApplication());
  tester.startPage(TestAjaxDropDown.class);
  FormTester formTester=tester.newFormTester("form");
  formTester.select("combo1", 0);
  tester.executeAjaxEvent("form:combo1", "onchange");
  formTester.submit();
  tester.assertNoErrorMessage();

what I got is that after firing the onchange event combo1 gets a null
value as object model and this does not happen when I use a browser. If
I do not fire the event the application reports that combo2 has no
element selected.
Am I  missing something or is it a bug?

Grazie,
Giovanni

P.S. I built a simple test case that I insert here

main page class

package com.sg2net.test;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.PropertyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class TestAjaxDropDown extends WebPage {

  private static final Logger
logger=LoggerFactory.getLogger(TestAjaxDropDown.class.getName());

  public TestAjaxDropDown() {
  add(new FeedbackPanel("feedback"));
  add(new TestAjaxDropDownFrom("form"));
  }

  private class DomainObject1 implements Serializable {
  public DomainObject1(long id, String description) {
  super();
  this.id = id;
  this.description = description;
  }
  private static final long serialVersionUID = 1L;
  private long id;
  private String description;

  public long getId() {
  return id;
  }
  public void setId(long id) {
  this.id = id;
  }
  public String getDescription() {
  return description;
  }
  public void setDescription(String description) {
  this.description = description;
  }
  @Override
  public int hashCode() {
  final int prime = 31;
  int result = 1;
  result = prime * result + getOuterType().hashCode();
  result = prime * result + (int) (id ^ (id >>> 32));
  return result;
  }
  @Override
  public boolean equals(Object obj) {
  if (this == obj)
  return true;
  if (obj == null)
  return false;
  if (getClass() != obj.getClass())
  return false;
  DomainObject1 other = (DomainObject1) obj;
  if (!getOuterType().equals(other.getOuterType()))
  return false;
  if (id != other.id)
  return false;
  return true;
  }
  private TestAjaxDropDown getOuterType() {

Re: Unable to use wicket tester to simulate ajax behavior

2012-07-24 Thread Martin Grigorov
Hi,

File a ticket with a test case.

On Tue, Jul 24, 2012 at 9:34 AM, Giovanni Cuccu
 wrote:
> Hi,
> sorry for the late response. Should I file a bug for this?
> Thanks,
> Giovanni
> Il 11/07/12 15.13, Giovanni Cuccu ha scritto:
>
>> Hi Martin,
>>  I did the change you suggested but the test fails with esame error:
>>
>> junit.framework.AssertionFailedError: expect no error message, but
>> contains
>>Field 'combo1' is required.
>>
>> Thanks,
>>  Giovanni
>> Il 11/07/12 09.23, Martin Grigorov ha scritto:
>>>
>>> Hi,
>>>
>>> Try with:
>>>
>>> tester.getRequest().setParameter("form:combo1", "0");
>>> tester.executeAjaxEvent("form:combo1", "onchange");
>>>
>>> On Tue, Jul 10, 2012 at 10:10 AM, Giovanni Cuccu
>>>  wrote:
>>>>
>>>> Hi,
>>>>  can someone give me an hint on this?
>>>> I tried to explain my problem providing a complete example and
>>>> explaining
>>>> what I was trying to achieve.
>>>> I'd like to know if there is a specific reason of getting no answer so I
>>>> can
>>>> change something on my side the next time I need to write to the list.
>>>> Thanks,
>>>>  Giovanni
>>>> Il 05/07/12 08.10, Giovanni Cuccu ha scritto:
>>>>
>>>>> Hi all,
>>>>>      I'm trying to test a wicket 1.5.7 application and I'm hitting a
>>>>> strange (at least for me) issue.
>>>>> I have two dropdowns (combo 1 and combo2) and when I select one value
>>>>> from combo1 I fire an AjaxUpdateBehavior on onchange event which
>>>>> selects
>>>>> a value on combo2.
>>>>> If I use the application everything is working as expected but If I try
>>>>> to simulate the application with wicket tester I come into trouble.
>>>>> Basically the test code is the following one:
>>>>>
>>>>>  WicketTester tester= new WicketTester(new
>>>>> WicketApplication());
>>>>>  tester.startPage(TestAjaxDropDown.class);
>>>>>  FormTester formTester=tester.newFormTester("form");
>>>>>  formTester.select("combo1", 0);
>>>>>  tester.executeAjaxEvent("form:combo1", "onchange");
>>>>>  formTester.submit();
>>>>>  tester.assertNoErrorMessage();
>>>>>
>>>>> what I got is that after firing the onchange event combo1 gets a null
>>>>> value as object model and this does not happen when I use a browser. If
>>>>> I do not fire the event the application reports that combo2 has no
>>>>> element selected.
>>>>> Am I  missing something or is it a bug?
>>>>>
>>>>> Grazie,
>>>>>Giovanni
>>>>>
>>>>> P.S. I built a simple test case that I insert here
>>>>>
>>>>> main page class
>>>>>
>>>>> package com.sg2net.test;
>>>>>
>>>>> import java.io.Serializable;
>>>>> import java.util.ArrayList;
>>>>> import java.util.List;
>>>>>
>>>>> import org.apache.wicket.ajax.AjaxRequestTarget;
>>>>> import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
>>>>> import org.apache.wicket.markup.html.WebPage;
>>>>> import org.apache.wicket.markup.html.form.ChoiceRenderer;
>>>>> import org.apache.wicket.markup.html.form.DropDownChoice;
>>>>> import org.apache.wicket.markup.html.form.Form;
>>>>> import org.apache.wicket.markup.html.panel.FeedbackPanel;
>>>>> import org.apache.wicket.model.PropertyModel;
>>>>> import org.slf4j.Logger;
>>>>> import org.slf4j.LoggerFactory;
>>>>>
>>>>>
>>>>> public class TestAjaxDropDown extends WebPage {
>>>>>
>>>>>  private static final Logger
>>>>> logger=LoggerFactory.getLogger(TestAjaxDropDown.class.getName());
>>>>>
>>>>>  public TestAjaxDropDown() {
>>>>>  add(new FeedbackPanel("feedback"));
>>>>>  add(new TestAjaxDropDownFrom("form"));
>>>>>  }
>>>>>
>>>>>  private class Do

Re: Unable to use wicket tester to simulate ajax behavior

2012-07-23 Thread Giovanni Cuccu

Hi,
sorry for the late response. Should I file a bug for this?
Thanks,
Giovanni
Il 11/07/12 15.13, Giovanni Cuccu ha scritto:

Hi Martin,
 I did the change you suggested but the test fails with esame error:

junit.framework.AssertionFailedError: expect no error message, but 
contains

   Field 'combo1' is required.

Thanks,
 Giovanni
Il 11/07/12 09.23, Martin Grigorov ha scritto:

Hi,

Try with:

tester.getRequest().setParameter("form:combo1", "0");
tester.executeAjaxEvent("form:combo1", "onchange");

On Tue, Jul 10, 2012 at 10:10 AM, Giovanni Cuccu
 wrote:

Hi,
 can someone give me an hint on this?
I tried to explain my problem providing a complete example and 
explaining

what I was trying to achieve.
I'd like to know if there is a specific reason of getting no answer 
so I can

change something on my side the next time I need to write to the list.
Thanks,
 Giovanni
Il 05/07/12 08.10, Giovanni Cuccu ha scritto:


Hi all,
 I'm trying to test a wicket 1.5.7 application and I'm hitting a
strange (at least for me) issue.
I have two dropdowns (combo 1 and combo2) and when I select one value
from combo1 I fire an AjaxUpdateBehavior on onchange event which 
selects

a value on combo2.
If I use the application everything is working as expected but If I 
try

to simulate the application with wicket tester I come into trouble.
Basically the test code is the following one:

 WicketTester tester= new WicketTester(new 
WicketApplication());

 tester.startPage(TestAjaxDropDown.class);
 FormTester formTester=tester.newFormTester("form");
 formTester.select("combo1", 0);
 tester.executeAjaxEvent("form:combo1", "onchange");
 formTester.submit();
 tester.assertNoErrorMessage();

what I got is that after firing the onchange event combo1 gets a null
value as object model and this does not happen when I use a 
browser. If

I do not fire the event the application reports that combo2 has no
element selected.
Am I  missing something or is it a bug?

Grazie,
   Giovanni

P.S. I built a simple test case that I insert here

main page class

package com.sg2net.test;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.PropertyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class TestAjaxDropDown extends WebPage {

 private static final Logger
logger=LoggerFactory.getLogger(TestAjaxDropDown.class.getName());

 public TestAjaxDropDown() {
 add(new FeedbackPanel("feedback"));
 add(new TestAjaxDropDownFrom("form"));
 }

 private class DomainObject1 implements Serializable {
 public DomainObject1(long id, String description) {
 super();
 this.id = id;
 this.description = description;
 }
 private static final long serialVersionUID = 1L;
 private long id;
 private String description;

 public long getId() {
 return id;
 }
 public void setId(long id) {
 this.id = id;
 }
 public String getDescription() {
 return description;
 }
 public void setDescription(String description) {
 this.description = description;
 }
 @Override
 public int hashCode() {
 final int prime = 31;
 int result = 1;
 result = prime * result + getOuterType().hashCode();
 result = prime * result + (int) (id ^ (id >>> 32));
 return result;
 }
 @Override
 public boolean equals(Object obj) {
 if (this == obj)
 return true;
 if (obj == null)
 return false;
 if (getClass() != obj.getClass())
 return false;
 DomainObject1 other = (DomainObject1) obj;
 if (!getOuterType().equals(other.getOuterType()))
 return false;
 if (id != other.id)
 return false;
 return true;
 }
 private TestAjaxDropDown getOuterType() {
 return TestAjaxDropDown.this;
 }

 }

 private class DomainObject2 implements Serializable {
 public DomainObject2(long id, String description) {
 super();
 this.id = id;
 this.description = description;
 }

Re: Unable to use wicket tester to simulate ajax behavior

2012-07-11 Thread Giovanni Cuccu

Hi Martin,
 I did the change you suggested but the test fails with esame error:

junit.framework.AssertionFailedError: expect no error message, but contains
   Field 'combo1' is required.

Thanks,
 Giovanni
Il 11/07/12 09.23, Martin Grigorov ha scritto:

Hi,

Try with:

tester.getRequest().setParameter("form:combo1", "0");
tester.executeAjaxEvent("form:combo1", "onchange");

On Tue, Jul 10, 2012 at 10:10 AM, Giovanni Cuccu
 wrote:

Hi,
 can someone give me an hint on this?
I tried to explain my problem providing a complete example and explaining
what I was trying to achieve.
I'd like to know if there is a specific reason of getting no answer so I can
change something on my side the next time I need to write to the list.
Thanks,
 Giovanni
Il 05/07/12 08.10, Giovanni Cuccu ha scritto:


Hi all,
 I'm trying to test a wicket 1.5.7 application and I'm hitting a
strange (at least for me) issue.
I have two dropdowns (combo 1 and combo2) and when I select one value
from combo1 I fire an AjaxUpdateBehavior on onchange event which selects
a value on combo2.
If I use the application everything is working as expected but If I try
to simulate the application with wicket tester I come into trouble.
Basically the test code is the following one:

 WicketTester tester= new WicketTester(new WicketApplication());
 tester.startPage(TestAjaxDropDown.class);
 FormTester formTester=tester.newFormTester("form");
 formTester.select("combo1", 0);
 tester.executeAjaxEvent("form:combo1", "onchange");
 formTester.submit();
 tester.assertNoErrorMessage();

what I got is that after firing the onchange event combo1 gets a null
value as object model and this does not happen when I use a browser. If
I do not fire the event the application reports that combo2 has no
element selected.
Am I  missing something or is it a bug?

Grazie,
   Giovanni

P.S. I built a simple test case that I insert here

main page class

package com.sg2net.test;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.PropertyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class TestAjaxDropDown extends WebPage {

 private static final Logger
logger=LoggerFactory.getLogger(TestAjaxDropDown.class.getName());

 public TestAjaxDropDown() {
 add(new FeedbackPanel("feedback"));
 add(new TestAjaxDropDownFrom("form"));
 }

 private class DomainObject1 implements Serializable {
 public DomainObject1(long id, String description) {
 super();
 this.id = id;
 this.description = description;
 }
 private static final long serialVersionUID = 1L;
 private long id;
 private String description;

 public long getId() {
 return id;
 }
 public void setId(long id) {
 this.id = id;
 }
 public String getDescription() {
 return description;
 }
 public void setDescription(String description) {
 this.description = description;
 }
 @Override
 public int hashCode() {
 final int prime = 31;
 int result = 1;
 result = prime * result + getOuterType().hashCode();
 result = prime * result + (int) (id ^ (id >>> 32));
 return result;
 }
 @Override
 public boolean equals(Object obj) {
 if (this == obj)
 return true;
 if (obj == null)
 return false;
 if (getClass() != obj.getClass())
 return false;
 DomainObject1 other = (DomainObject1) obj;
 if (!getOuterType().equals(other.getOuterType()))
 return false;
 if (id != other.id)
 return false;
 return true;
 }
 private TestAjaxDropDown getOuterType() {
 return TestAjaxDropDown.this;
 }

 }

 private class DomainObject2 implements Serializable {
 public DomainObject2(long id, String description) {
 super();
 this.id = id;
 this.description = description;
 }
 private static final long serialVersionUID = 1L;
 private long id;
 private String description;

 public long getId() {

Re: Unable to use wicket tester to simulate ajax behavior

2012-07-11 Thread Martin Grigorov
Hi,

Try with:

tester.getRequest().setParameter("form:combo1", "0");
tester.executeAjaxEvent("form:combo1", "onchange");

On Tue, Jul 10, 2012 at 10:10 AM, Giovanni Cuccu
 wrote:
> Hi,
> can someone give me an hint on this?
> I tried to explain my problem providing a complete example and explaining
> what I was trying to achieve.
> I'd like to know if there is a specific reason of getting no answer so I can
> change something on my side the next time I need to write to the list.
> Thanks,
> Giovanni
> Il 05/07/12 08.10, Giovanni Cuccu ha scritto:
>
>>
>> Hi all,
>> I'm trying to test a wicket 1.5.7 application and I'm hitting a
>> strange (at least for me) issue.
>> I have two dropdowns (combo 1 and combo2) and when I select one value
>> from combo1 I fire an AjaxUpdateBehavior on onchange event which selects
>> a value on combo2.
>> If I use the application everything is working as expected but If I try
>> to simulate the application with wicket tester I come into trouble.
>> Basically the test code is the following one:
>>
>> WicketTester tester= new WicketTester(new WicketApplication());
>> tester.startPage(TestAjaxDropDown.class);
>> FormTester formTester=tester.newFormTester("form");
>> formTester.select("combo1", 0);
>> tester.executeAjaxEvent("form:combo1", "onchange");
>> formTester.submit();
>> tester.assertNoErrorMessage();
>>
>> what I got is that after firing the onchange event combo1 gets a null
>> value as object model and this does not happen when I use a browser. If
>> I do not fire the event the application reports that combo2 has no
>> element selected.
>> Am I  missing something or is it a bug?
>>
>> Grazie,
>>   Giovanni
>>
>> P.S. I built a simple test case that I insert here
>>
>> main page class
>>
>> package com.sg2net.test;
>>
>> import java.io.Serializable;
>> import java.util.ArrayList;
>> import java.util.List;
>>
>> import org.apache.wicket.ajax.AjaxRequestTarget;
>> import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
>> import org.apache.wicket.markup.html.WebPage;
>> import org.apache.wicket.markup.html.form.ChoiceRenderer;
>> import org.apache.wicket.markup.html.form.DropDownChoice;
>> import org.apache.wicket.markup.html.form.Form;
>> import org.apache.wicket.markup.html.panel.FeedbackPanel;
>> import org.apache.wicket.model.PropertyModel;
>> import org.slf4j.Logger;
>> import org.slf4j.LoggerFactory;
>>
>>
>> public class TestAjaxDropDown extends WebPage {
>>
>> private static final Logger
>> logger=LoggerFactory.getLogger(TestAjaxDropDown.class.getName());
>>
>> public TestAjaxDropDown() {
>> add(new FeedbackPanel("feedback"));
>> add(new TestAjaxDropDownFrom("form"));
>> }
>>
>> private class DomainObject1 implements Serializable {
>> public DomainObject1(long id, String description) {
>> super();
>> this.id = id;
>> this.description = description;
>> }
>> private static final long serialVersionUID = 1L;
>> private long id;
>> private String description;
>>
>> public long getId() {
>> return id;
>> }
>> public void setId(long id) {
>> this.id = id;
>> }
>> public String getDescription() {
>> return description;
>> }
>> public void setDescription(String description) {
>> this.description = description;
>> }
>> @Override
>> public int hashCode() {
>> final int prime = 31;
>> int result = 1;
>> result = prime * result + getOuterType().hashCode();
>> result = prime * result + (int) (id ^ (id >>> 32));
>> return result;
>> }
>> @Override
>> public boolean equals(Object obj) {
>> if (this == obj)
>> return true;
>> if (obj == null)
>> return false;
>> if (getClass() != obj.getClass())
>> return false;
>> DomainObject1 other = (DomainObject1) obj;
>> if (!getOuterType().equals(other.getOuterType()))
>>

Re: Unable to use wicket tester to simulate ajax behavior

2012-07-10 Thread Giovanni Cuccu

Hi,
can someone give me an hint on this?
I tried to explain my problem providing a complete example and 
explaining what I was trying to achieve.
I'd like to know if there is a specific reason of getting no answer so I 
can change something on my side the next time I need to write to the list.

Thanks,
Giovanni
Il 05/07/12 08.10, Giovanni Cuccu ha scritto:


Hi all,
I'm trying to test a wicket 1.5.7 application and I'm hitting a
strange (at least for me) issue.
I have two dropdowns (combo 1 and combo2) and when I select one value
from combo1 I fire an AjaxUpdateBehavior on onchange event which selects
a value on combo2.
If I use the application everything is working as expected but If I try
to simulate the application with wicket tester I come into trouble.
Basically the test code is the following one:

WicketTester tester= new WicketTester(new WicketApplication());
tester.startPage(TestAjaxDropDown.class);
FormTester formTester=tester.newFormTester("form");
formTester.select("combo1", 0);
tester.executeAjaxEvent("form:combo1", "onchange");
formTester.submit();
tester.assertNoErrorMessage();

what I got is that after firing the onchange event combo1 gets a null
value as object model and this does not happen when I use a browser. If
I do not fire the event the application reports that combo2 has no
element selected.
Am I  missing something or is it a bug?

Grazie,
  Giovanni

P.S. I built a simple test case that I insert here

main page class

package com.sg2net.test;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.PropertyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class TestAjaxDropDown extends WebPage {

private static final Logger
logger=LoggerFactory.getLogger(TestAjaxDropDown.class.getName());

public TestAjaxDropDown() {
add(new FeedbackPanel("feedback"));
add(new TestAjaxDropDownFrom("form"));
}

private class DomainObject1 implements Serializable {
public DomainObject1(long id, String description) {
super();
this.id = id;
this.description = description;
}
private static final long serialVersionUID = 1L;
private long id;
private String description;

public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + getOuterType().hashCode();
result = prime * result + (int) (id ^ (id >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DomainObject1 other = (DomainObject1) obj;
if (!getOuterType().equals(other.getOuterType()))
return false;
if (id != other.id)
return false;
return true;
}
private TestAjaxDropDown getOuterType() {
return TestAjaxDropDown.this;
}

}

private class DomainObject2 implements Serializable {
public DomainObject2(long id, String description) {
super();
this.id = id;
this.description = description;
}
private static final long serialVersionUID = 1L;
private long id;
private String description;

public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + getOuterType().hashCode();
result = prime * result + (int) (id ^ (id >>> 32));
return r

Unable to use wicket tester to simulate ajax behavior

2012-07-04 Thread Giovanni Cuccu


Hi all,
I'm trying to test a wicket 1.5.7 application and I'm hitting a
strange (at least for me) issue.
I have two dropdowns (combo 1 and combo2) and when I select one value
from combo1 I fire an AjaxUpdateBehavior on onchange event which selects
a value on combo2.
If I use the application everything is working as expected but If I try
to simulate the application with wicket tester I come into trouble.
Basically the test code is the following one:

WicketTester tester= new WicketTester(new WicketApplication());
tester.startPage(TestAjaxDropDown.class);
FormTester formTester=tester.newFormTester("form");
formTester.select("combo1", 0);
tester.executeAjaxEvent("form:combo1", "onchange");
formTester.submit();
tester.assertNoErrorMessage();

what I got is that after firing the onchange event combo1 gets a null
value as object model and this does not happen when I use a browser. If
I do not fire the event the application reports that combo2 has no
element selected.
Am I  missing something or is it a bug?

Grazie,
  Giovanni

P.S. I built a simple test case that I insert here

main page class

package com.sg2net.test;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.model.PropertyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


public class TestAjaxDropDown extends WebPage {

private static final Logger
logger=LoggerFactory.getLogger(TestAjaxDropDown.class.getName());

public TestAjaxDropDown() {
add(new FeedbackPanel("feedback"));
add(new TestAjaxDropDownFrom("form"));
}

private class DomainObject1 implements Serializable {
public DomainObject1(long id, String description) {
super();
this.id = id;
this.description = description;
}
private static final long serialVersionUID = 1L;
private long id;
private String description;

public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + getOuterType().hashCode();
result = prime * result + (int) (id ^ (id >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DomainObject1 other = (DomainObject1) obj;
if (!getOuterType().equals(other.getOuterType()))
return false;
if (id != other.id)
return false;
return true;
}
private TestAjaxDropDown getOuterType() {
return TestAjaxDropDown.this;
}

}

private class DomainObject2 implements Serializable {
public DomainObject2(long id, String description) {
super();
this.id = id;
this.description = description;
}
private static final long serialVersionUID = 1L;
private long id;
private String description;

public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + getOuterType().hashCode();
result = prime * result + (int) (id ^ (id >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
DomainObject2 other = (DomainObject2) obj;
if (!getOuterType().eq

Re: Verifying image HREF with Wicket tester

2012-06-20 Thread Carl-Eric Menzel
In this case, yes, I think.

Carl-Eric

On Wed, 20 Jun 2012 09:27:27 -0600
Alec Swan  wrote:

> So, this is a bug, right?
> 
> On Wed, Jun 20, 2012 at 2:36 AM, Martin Grigorov
>  wrote:
> > On Wed, Jun 20, 2012 at 11:34 AM, Carl-Eric Menzel
> >  wrote:
> >> On Tue, 19 Jun 2012 15:21:17 -0600
> >> Alec Swan  wrote:
> >>
> >>> I had to make sure that my  element had a closing 
> >>>
> >>> The problem is that
> >>> org.apache.wicket.util.tester.TagTester#createTagByAttribute
> >>> requires the  element to be closed, i.e.  or
> >>> . Otherwise closeTag variable is never set and the
> >>> loop does not exit.
> >>>
> >>> Seems like a bug to me, isn't it?
> >>
> >> A lone open  tag wouldn't be valid XHTML. Does our HTML5
> >> support include support for non-wellformed documents?
> >
> > Yes.
> >
> >>
> >> Carl-Eric
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >
> >
> >
> > --
> > 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
> >
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


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



Re: Verifying image HREF with Wicket tester

2012-06-20 Thread Alec Swan
So, this is a bug, right?

On Wed, Jun 20, 2012 at 2:36 AM, Martin Grigorov  wrote:
> On Wed, Jun 20, 2012 at 11:34 AM, Carl-Eric Menzel
>  wrote:
>> On Tue, 19 Jun 2012 15:21:17 -0600
>> Alec Swan  wrote:
>>
>>> I had to make sure that my  element had a closing 
>>>
>>> The problem is that
>>> org.apache.wicket.util.tester.TagTester#createTagByAttribute requires
>>> the  element to be closed, i.e.  or . Otherwise
>>> closeTag variable is never set and the loop does not exit.
>>>
>>> Seems like a bug to me, isn't it?
>>
>> A lone open  tag wouldn't be valid XHTML. Does our HTML5 support
>> include support for non-wellformed documents?
>
> Yes.
>
>>
>> Carl-Eric
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
>
> --
> 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
>

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



Re: Verifying image HREF with Wicket tester

2012-06-20 Thread Martin Grigorov
On Wed, Jun 20, 2012 at 11:34 AM, Carl-Eric Menzel
 wrote:
> On Tue, 19 Jun 2012 15:21:17 -0600
> Alec Swan  wrote:
>
>> I had to make sure that my  element had a closing 
>>
>> The problem is that
>> org.apache.wicket.util.tester.TagTester#createTagByAttribute requires
>> the  element to be closed, i.e.  or . Otherwise
>> closeTag variable is never set and the loop does not exit.
>>
>> Seems like a bug to me, isn't it?
>
> A lone open  tag wouldn't be valid XHTML. Does our HTML5 support
> include support for non-wellformed documents?

Yes.

>
> Carl-Eric
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



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



Re: Verifying image HREF with Wicket tester

2012-06-20 Thread Carl-Eric Menzel
On Tue, 19 Jun 2012 15:21:17 -0600
Alec Swan  wrote:

> I had to make sure that my  element had a closing 
> 
> The problem is that
> org.apache.wicket.util.tester.TagTester#createTagByAttribute requires
> the  element to be closed, i.e.  or . Otherwise
> closeTag variable is never set and the loop does not exit.
> 
> Seems like a bug to me, isn't it?

A lone open  tag wouldn't be valid XHTML. Does our HTML5 support
include support for non-wellformed documents?

Carl-Eric

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



Re: Verifying image HREF with Wicket tester

2012-06-19 Thread Martin Grigorov
Yes, this should be improved.
Please create a ticket with a test case.

On Wed, Jun 20, 2012 at 12:21 AM, Alec Swan  wrote:
> I had to make sure that my  element had a closing 
>
> The problem is that
> org.apache.wicket.util.tester.TagTester#createTagByAttribute requires
> the  element to be closed, i.e.  or . Otherwise
> closeTag variable is never set and the loop does not exit.
>
> Seems like a bug to me, isn't it?
>
> On Tue, Jun 19, 2012 at 1:18 PM, Martin Grigorov  wrote:
>> Fire the debugger and see what happens.
>>
>> On Tue, Jun 19, 2012 at 8:56 PM, Alec Swan  wrote:
>>> Martin, if there was a problem with repeater wouldn't I have had
>>> multiple myPanel components? Yet, tester.getTagByWicketId("myPanel")
>>> works.
>>>
>>> On Tue, Jun 19, 2012 at 9:46 AM, Alec Swan  wrote:
 getTagByWicketId(..) JavaDoc says that if there are multiple
 components with this wicket:id it will return the first one. Besides,
 we only have one cell in the table, so there should be only one
 myImage element.

 On Tue, Jun 19, 2012 at 9:37 AM, Martin Grigorov  
 wrote:
> On Tue, Jun 19, 2012 at 6:26 PM, Alec Swan  wrote:
>> Martin, this method works fine on the top page elements but not on the
>> nested panel's elements. I need to get the HREF attribute of
>> "myForm:rows:1:cols:2:myPanel:myImage" on the top page.
>
> '2' is the component id of an item inside a repeater.
> That means you have several components with id 'myImage'
>
>>
>> THIS WORKS: tester.getTagByWicketId("myForm")
>> THIS WORKS: tester.getTagByWicketId("rows")
>> THIS WORKS: tester.getTagByWicketId("myPanel")
>>
>> THIS DOES NOT WORK: tester.getTagByWicketId("myImage")
>> THIS DOES NOT WORK: tester.getTagByWicketId("myPanel:myImage")
>>
>> Thoughts?
>>
>> Thanks,
>>
>> Alec
>>
>> On Tue, Jun 19, 2012 at 8:42 AM, Martin Grigorov  
>> wrote:
>>> See #getTagBy*** methods.
>>> This way you get a TagTester and then you can check the attributes.
>>>
>>> On Tue, Jun 19, 2012 at 5:39 PM, Alec Swan  wrote:
 Hello,

 How can I access and verify the HREF attribute of an Image with 
 WicketTester?

 Thanks,

 Alec

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

>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
>
> --
> 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
>
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>
>>
>>
>> --
>> 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
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



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



Re: Verifying image HREF with Wicket tester

2012-06-19 Thread Alec Swan
I had to make sure that my  element had a closing 

The problem is that
org.apache.wicket.util.tester.TagTester#createTagByAttribute requires
the  element to be closed, i.e.  or . Otherwise
closeTag variable is never set and the loop does not exit.

Seems like a bug to me, isn't it?

On Tue, Jun 19, 2012 at 1:18 PM, Martin Grigorov  wrote:
> Fire the debugger and see what happens.
>
> On Tue, Jun 19, 2012 at 8:56 PM, Alec Swan  wrote:
>> Martin, if there was a problem with repeater wouldn't I have had
>> multiple myPanel components? Yet, tester.getTagByWicketId("myPanel")
>> works.
>>
>> On Tue, Jun 19, 2012 at 9:46 AM, Alec Swan  wrote:
>>> getTagByWicketId(..) JavaDoc says that if there are multiple
>>> components with this wicket:id it will return the first one. Besides,
>>> we only have one cell in the table, so there should be only one
>>> myImage element.
>>>
>>> On Tue, Jun 19, 2012 at 9:37 AM, Martin Grigorov  
>>> wrote:
 On Tue, Jun 19, 2012 at 6:26 PM, Alec Swan  wrote:
> Martin, this method works fine on the top page elements but not on the
> nested panel's elements. I need to get the HREF attribute of
> "myForm:rows:1:cols:2:myPanel:myImage" on the top page.

 '2' is the component id of an item inside a repeater.
 That means you have several components with id 'myImage'

>
> THIS WORKS: tester.getTagByWicketId("myForm")
> THIS WORKS: tester.getTagByWicketId("rows")
> THIS WORKS: tester.getTagByWicketId("myPanel")
>
> THIS DOES NOT WORK: tester.getTagByWicketId("myImage")
> THIS DOES NOT WORK: tester.getTagByWicketId("myPanel:myImage")
>
> Thoughts?
>
> Thanks,
>
> Alec
>
> On Tue, Jun 19, 2012 at 8:42 AM, Martin Grigorov  
> wrote:
>> See #getTagBy*** methods.
>> This way you get a TagTester and then you can check the attributes.
>>
>> On Tue, Jun 19, 2012 at 5:39 PM, Alec Swan  wrote:
>>> Hello,
>>>
>>> How can I access and verify the HREF attribute of an Image with 
>>> WicketTester?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>
>>
>>
>> --
>> 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
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



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

>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
>
> --
> 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
>

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



Re: Verifying image HREF with Wicket tester

2012-06-19 Thread Martin Grigorov
Fire the debugger and see what happens.

On Tue, Jun 19, 2012 at 8:56 PM, Alec Swan  wrote:
> Martin, if there was a problem with repeater wouldn't I have had
> multiple myPanel components? Yet, tester.getTagByWicketId("myPanel")
> works.
>
> On Tue, Jun 19, 2012 at 9:46 AM, Alec Swan  wrote:
>> getTagByWicketId(..) JavaDoc says that if there are multiple
>> components with this wicket:id it will return the first one. Besides,
>> we only have one cell in the table, so there should be only one
>> myImage element.
>>
>> On Tue, Jun 19, 2012 at 9:37 AM, Martin Grigorov  
>> wrote:
>>> On Tue, Jun 19, 2012 at 6:26 PM, Alec Swan  wrote:
 Martin, this method works fine on the top page elements but not on the
 nested panel's elements. I need to get the HREF attribute of
 "myForm:rows:1:cols:2:myPanel:myImage" on the top page.
>>>
>>> '2' is the component id of an item inside a repeater.
>>> That means you have several components with id 'myImage'
>>>

 THIS WORKS: tester.getTagByWicketId("myForm")
 THIS WORKS: tester.getTagByWicketId("rows")
 THIS WORKS: tester.getTagByWicketId("myPanel")

 THIS DOES NOT WORK: tester.getTagByWicketId("myImage")
 THIS DOES NOT WORK: tester.getTagByWicketId("myPanel:myImage")

 Thoughts?

 Thanks,

 Alec

 On Tue, Jun 19, 2012 at 8:42 AM, Martin Grigorov  
 wrote:
> See #getTagBy*** methods.
> This way you get a TagTester and then you can check the attributes.
>
> On Tue, Jun 19, 2012 at 5:39 PM, Alec Swan  wrote:
>> Hello,
>>
>> How can I access and verify the HREF attribute of an Image with 
>> WicketTester?
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
>
> --
> 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
>

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

>>>
>>>
>>>
>>> --
>>> 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
>>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



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



Re: Verifying image HREF with Wicket tester

2012-06-19 Thread Alec Swan
Martin, if there was a problem with repeater wouldn't I have had
multiple myPanel components? Yet, tester.getTagByWicketId("myPanel")
works.

On Tue, Jun 19, 2012 at 9:46 AM, Alec Swan  wrote:
> getTagByWicketId(..) JavaDoc says that if there are multiple
> components with this wicket:id it will return the first one. Besides,
> we only have one cell in the table, so there should be only one
> myImage element.
>
> On Tue, Jun 19, 2012 at 9:37 AM, Martin Grigorov  wrote:
>> On Tue, Jun 19, 2012 at 6:26 PM, Alec Swan  wrote:
>>> Martin, this method works fine on the top page elements but not on the
>>> nested panel's elements. I need to get the HREF attribute of
>>> "myForm:rows:1:cols:2:myPanel:myImage" on the top page.
>>
>> '2' is the component id of an item inside a repeater.
>> That means you have several components with id 'myImage'
>>
>>>
>>> THIS WORKS: tester.getTagByWicketId("myForm")
>>> THIS WORKS: tester.getTagByWicketId("rows")
>>> THIS WORKS: tester.getTagByWicketId("myPanel")
>>>
>>> THIS DOES NOT WORK: tester.getTagByWicketId("myImage")
>>> THIS DOES NOT WORK: tester.getTagByWicketId("myPanel:myImage")
>>>
>>> Thoughts?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> On Tue, Jun 19, 2012 at 8:42 AM, Martin Grigorov  
>>> wrote:
 See #getTagBy*** methods.
 This way you get a TagTester and then you can check the attributes.

 On Tue, Jun 19, 2012 at 5:39 PM, Alec Swan  wrote:
> Hello,
>
> How can I access and verify the HREF attribute of an Image with 
> WicketTester?
>
> Thanks,
>
> Alec
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



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

>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>
>>
>>
>> --
>> 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
>>

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



Re: Verifying image HREF with Wicket tester

2012-06-19 Thread Alec Swan
getTagByWicketId(..) JavaDoc says that if there are multiple
components with this wicket:id it will return the first one. Besides,
we only have one cell in the table, so there should be only one
myImage element.

On Tue, Jun 19, 2012 at 9:37 AM, Martin Grigorov  wrote:
> On Tue, Jun 19, 2012 at 6:26 PM, Alec Swan  wrote:
>> Martin, this method works fine on the top page elements but not on the
>> nested panel's elements. I need to get the HREF attribute of
>> "myForm:rows:1:cols:2:myPanel:myImage" on the top page.
>
> '2' is the component id of an item inside a repeater.
> That means you have several components with id 'myImage'
>
>>
>> THIS WORKS: tester.getTagByWicketId("myForm")
>> THIS WORKS: tester.getTagByWicketId("rows")
>> THIS WORKS: tester.getTagByWicketId("myPanel")
>>
>> THIS DOES NOT WORK: tester.getTagByWicketId("myImage")
>> THIS DOES NOT WORK: tester.getTagByWicketId("myPanel:myImage")
>>
>> Thoughts?
>>
>> Thanks,
>>
>> Alec
>>
>> On Tue, Jun 19, 2012 at 8:42 AM, Martin Grigorov  
>> wrote:
>>> See #getTagBy*** methods.
>>> This way you get a TagTester and then you can check the attributes.
>>>
>>> On Tue, Jun 19, 2012 at 5:39 PM, Alec Swan  wrote:
 Hello,

 How can I access and verify the HREF attribute of an Image with 
 WicketTester?

 Thanks,

 Alec

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

>>>
>>>
>>>
>>> --
>>> 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
>>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
>
> --
> 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
>

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



Re: Verifying image HREF with Wicket tester

2012-06-19 Thread Martin Grigorov
On Tue, Jun 19, 2012 at 6:26 PM, Alec Swan  wrote:
> Martin, this method works fine on the top page elements but not on the
> nested panel's elements. I need to get the HREF attribute of
> "myForm:rows:1:cols:2:myPanel:myImage" on the top page.

'2' is the component id of an item inside a repeater.
That means you have several components with id 'myImage'

>
> THIS WORKS: tester.getTagByWicketId("myForm")
> THIS WORKS: tester.getTagByWicketId("rows")
> THIS WORKS: tester.getTagByWicketId("myPanel")
>
> THIS DOES NOT WORK: tester.getTagByWicketId("myImage")
> THIS DOES NOT WORK: tester.getTagByWicketId("myPanel:myImage")
>
> Thoughts?
>
> Thanks,
>
> Alec
>
> On Tue, Jun 19, 2012 at 8:42 AM, Martin Grigorov  wrote:
>> See #getTagBy*** methods.
>> This way you get a TagTester and then you can check the attributes.
>>
>> On Tue, Jun 19, 2012 at 5:39 PM, Alec Swan  wrote:
>>> Hello,
>>>
>>> How can I access and verify the HREF attribute of an Image with 
>>> WicketTester?
>>>
>>> Thanks,
>>>
>>> Alec
>>>
>>> -
>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>>> For additional commands, e-mail: users-h...@wicket.apache.org
>>>
>>
>>
>>
>> --
>> 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
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



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



Re: Verifying image HREF with Wicket tester

2012-06-19 Thread Alec Swan
Martin, this method works fine on the top page elements but not on the
nested panel's elements. I need to get the HREF attribute of
"myForm:rows:1:cols:2:myPanel:myImage" on the top page.

THIS WORKS: tester.getTagByWicketId("myForm")
THIS WORKS: tester.getTagByWicketId("rows")
THIS WORKS: tester.getTagByWicketId("myPanel")

THIS DOES NOT WORK: tester.getTagByWicketId("myImage")
THIS DOES NOT WORK: tester.getTagByWicketId("myPanel:myImage")

Thoughts?

Thanks,

Alec

On Tue, Jun 19, 2012 at 8:42 AM, Martin Grigorov  wrote:
> See #getTagBy*** methods.
> This way you get a TagTester and then you can check the attributes.
>
> On Tue, Jun 19, 2012 at 5:39 PM, Alec Swan  wrote:
>> Hello,
>>
>> How can I access and verify the HREF attribute of an Image with WicketTester?
>>
>> Thanks,
>>
>> Alec
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
>
> --
> 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
>

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



Re: Verifying image HREF with Wicket tester

2012-06-19 Thread Martin Grigorov
See #getTagBy*** methods.
This way you get a TagTester and then you can check the attributes.

On Tue, Jun 19, 2012 at 5:39 PM, Alec Swan  wrote:
> Hello,
>
> How can I access and verify the HREF attribute of an Image with WicketTester?
>
> Thanks,
>
> Alec
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>



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



Verifying image HREF with Wicket tester

2012-06-19 Thread Alec Swan
Hello,

How can I access and verify the HREF attribute of an Image with WicketTester?

Thanks,

Alec

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



Re: How do I keep component paths constant across unit tests when using Wicket Tester

2012-04-21 Thread Martin Makundi
Test safely:

https://cwiki.apache.org/WICKET/type-safe-testing-in-wicket.html

2012/4/21 mmuk...@gmail.com :
> I have several wicket tests that target a sortable DataTable, specifically
> ajax-clicking the sortable column headers and asserting the contents of the
> rendered body rows. Now the component hierarchy of the table component's
> descendants is auto generated by the wicket framework, and results in paths
> to the sorting links (ajax) similar to:
>
>    table:topToolbars:toolbars:0:headers:1:header:orderByLink
>
> However, when the DataTable gets re-rendered across tests, the index of the
> toolbars component is incremented each time i.e similar to:
>
>    table:topToolbars:toolbars:1:headers:1:header:orderByLink
>
> which then breaks the hard-coded paths of the succeeding tests as they will
> no longer match.
>
> The code fragment for the datatable construction is as follows:
>
>                final PayeesProvider dataProvider = new PayeesProvider();
>                table = new DataTable("payees", columns,
> dataProvider, rowsPerPage);
>                table.setOutputMarkupId(true);
>                table.addTopToolbar(new AjaxFallbackHeadersToolbar(table, 
> dataProvider) {
>
>                        private static final long serialVersionUID = 
> -3509487788284410429L;
>
>                        @Override
>                        protected WebMarkupContainer newSortableHeader(final 
> String borderId,
> final String property, final ISortStateLocator locator) {
>                                return new AjaxFallbackOrderByBorder(borderId, 
> property, locator,
> getAjaxCallDecorator()) {
>
>                                        @Override
>                                        protected void onRender() {
>                                                System.out.printf("Path: 
> %s\n", this.getPageRelativePath());
>                                                super.onRender();
>                                        }
>
>                                        private static final long 
> serialVersionUID = -6399737639959498915L;
>
>                                        @Override
>                                        protected void onAjaxClick(final 
> AjaxRequestTarget target) {
>                                                target.add(getTable(), 
> navigator, navigatorInfoContainer);
>                                        }
>
>                                        @Override
>                                        protected void onSortChanged() {
>                                                super.onSortChanged();
>                                                getTable().setCurrentPage(0);
>                                        }
>                                };
>                        }
>                });
>                table.addBottomToolbar(new NoRecordsToolbar(table));
>                add(table);
>
> To be precise, when I run my tests, the above System.out.printf statement
> prints:
>
> (1st test)
>
>    Path: payees:topToolbars:toolbars:0:headers:1:header
>    Path: payees:topToolbars:toolbars:0:headers:2:header
>
> (2nd test)
>
>    Path: payees:topToolbars:toolbars:2:headers:1:header
>    Path: payees:topToolbars:toolbars:2:headers:2:header
>
> (3rd test)
>
>    Path: payees:topToolbars:toolbars:4:headers:1:header
>    Path: payees:topToolbars:toolbars:4:headers:2:header
>
> (4th test)
>
>    Path: payees:topToolbars:toolbars:6:headers:1:header
>    Path: payees:topToolbars:toolbars:6:headers:2:header
>    Path: payees:topToolbars:toolbars:6:headers:1:header
>    Path: payees:topToolbars:toolbars:6:headers:2:header
>    Path: payees:topToolbars:toolbars:6:headers:1:header
>    Path: payees:topToolbars:toolbars:6:headers:2:header
>
> (5th test)
>
>    Path: payees:topToolbars:toolbars:8:headers:1:header
>    Path: payees:topToolbars:toolbars:8:headers:2:header
>
> Does anyone know how I can force the index generation to be more
> deterministic / repeatable. Alternatively, is there a way of wild-carding or
> otherwise generalising the path, so as to make them immune to these
> increments?
>
> Any help will be greatly appreciated chaps!
>
>
> --
> View this message in context: 
> http://apache-wicket.1842946.n4.nabble.com/How-do-I-keep-component-paths-constant-across-unit-tests-when-using-Wicket-Tester-tp4577030p4577030.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>

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



Re: problem to test form in modal window with wicket tester

2011-05-26 Thread Andrea Del Bene
Sorry, I didn't noticed that getContent() is protected. The solution you 
found is perfect :-)

I didn't find getContent() method to modalWindow component, but it works
well in two steps :
ConnexionContentPanel loginPanel = (ConnexionContentPanel)
modalWindow.get(modalWindow.getContentId());
Form  loginForm = (Form) loginPanel.get("loginForm");

thanks a lot !

2011/5/26 Andrea Del Bene




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



Re: problem to test form in modal window with wicket tester

2011-05-26 Thread Mathilde Pellerin
I didn't find getContent() method to modalWindow component, but it works
well in two steps :
ConnexionContentPanel loginPanel = (ConnexionContentPanel)
modalWindow.get(modalWindow.getContentId());
Form loginForm = (Form) loginPanel.get("loginForm");

thanks a lot !

2011/5/26 Andrea Del Bene 

> Form id is corret, but remember that form and feedback panel are not added
> directly to modal window. They are inside ConnexionContentPanel which in
> turn  is added to modalwindow.
> In your test you should be able to access form calling getContent() before
> get("loginForm"), i.e:
>
> modalWindow.getContent().get("loginForm")
>
>
>
>  this is the code to construct modal window
>> final ModalWindowE4N modalConnexion = new
>> ModalWindowE4N("modalConnexion");
>> modalConnexion.setTitle("Connexion à l'espace membre");
>> modalConnexion.setContent(new
>> ConnexionContentPanel(modalConnexion.getContentId()));
>> add(modalConnexion);
>>
>> Form is added in ConnexionContentPanel :
>> public ConnexionContentPanel(String id) {
>> super(id);
>>
>> //Création du formulaire dont les champs seront liés aux champs
>> d'un
>> membre grace au model
>> Form  loginForm = new Form("loginForm",
>> new CompoundPropertyModel(new
>> LoadableDetachableModel() {
>>
>> @Override
>> protected Membre load() {
>> return new Membre();
>> }
>> }));
>>
>> //Création et ajout des champs id et pwd au formulaire
>> TextField  idField = new TextField("membreId");
>> idField.setRequired(true);
>> loginForm.add(idField);
>>
>> PasswordTextField pwdField = new PasswordTextField("password");
>> pwdField.setRequired(true);
>> loginForm.add(pwdField);
>>
>> //Ajout d'un du feedback panel qui contiendra les erreurs relevées
>> par le formulaire
>> final FeedbackPanel feedBackPanel = new FeedbackPanel("errorMsg");
>> feedBackPanel.setOutputMarkupId(true);
>> add(feedBackPanel);
>>
>> //création du bouton ajax pour soumettre le formulaire
>> AjaxButton submitbutton = new AjaxButton("ajaxSubmitLogin") {
>>
>> @Override
>> protected void onSubmit(AjaxRequestTarget target, Form
>>  form)
>> {
>> Membre modelObject = (Membre) form.getModelObject();
>> Membre membre;
>>
>> membre = serviceIdentif.identifier(modelObject.getId(),
>> modelObject.getPassword());
>> if(membre == null)
>> error("Identifiant ou mot de passe incorrect");
>> else
>> setResponsePage(TableauBordPage.class);
>> }
>>
>> @Override
>> protected void onError(AjaxRequestTarget target, Form
>>  form) {
>> target.addComponent(feedBackPanel);
>> }
>> };
>> loginForm.add(submitbutton);
>>
>> //ajout du formulaire au panel
>> add(loginForm);
>> }
>>
>> you can see that form id is correct.
>> It is the same problem with FeedBackPanel errorMsg : I get a null pointer
>> when I try to get it with modalWindow.get("errorMsg");
>>
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
 Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
06.60.78.79.03   E-mail
: mathilde.pelle...@gmail.com   Mon CV en ligne :
 http://www.mathilde-pellerin.fr/Mes
liens :  



Re: problem to test form in modal window with wicket tester

2011-05-26 Thread Andrea Del Bene
Form id is corret, but remember that form and feedback panel are not 
added directly to modal window. They are inside ConnexionContentPanel 
which in turn  is added to modalwindow.
In your test you should be able to access form calling getContent() 
before get("loginForm"), i.e:


modalWindow.getContent().get("loginForm")



this is the code to construct modal window
 final ModalWindowE4N modalConnexion = new
ModalWindowE4N("modalConnexion");
 modalConnexion.setTitle("Connexion à l'espace membre");
 modalConnexion.setContent(new
ConnexionContentPanel(modalConnexion.getContentId()));
 add(modalConnexion);

Form is added in ConnexionContentPanel :
public ConnexionContentPanel(String id) {
 super(id);

 //Création du formulaire dont les champs seront liés aux champs d'un
membre grace au model
 Form  loginForm = new Form("loginForm",
 new CompoundPropertyModel(new
LoadableDetachableModel() {

 @Override
 protected Membre load() {
 return new Membre();
 }
 }));

 //Création et ajout des champs id et pwd au formulaire
 TextField  idField = new TextField("membreId");
 idField.setRequired(true);
 loginForm.add(idField);

 PasswordTextField pwdField = new PasswordTextField("password");
 pwdField.setRequired(true);
 loginForm.add(pwdField);

 //Ajout d'un du feedback panel qui contiendra les erreurs relevées
par le formulaire
 final FeedbackPanel feedBackPanel = new FeedbackPanel("errorMsg");
 feedBackPanel.setOutputMarkupId(true);
 add(feedBackPanel);

 //création du bouton ajax pour soumettre le formulaire
 AjaxButton submitbutton = new AjaxButton("ajaxSubmitLogin") {

 @Override
 protected void onSubmit(AjaxRequestTarget target, Form  form)
{
 Membre modelObject = (Membre) form.getModelObject();
 Membre membre;

 membre = serviceIdentif.identifier(modelObject.getId(),
modelObject.getPassword());
 if(membre == null)
 error("Identifiant ou mot de passe incorrect");
 else
 setResponsePage(TableauBordPage.class);
 }

 @Override
 protected void onError(AjaxRequestTarget target, Form  form) {
 target.addComponent(feedBackPanel);
 }
 };
 loginForm.add(submitbutton);

 //ajout du formulaire au panel
 add(loginForm);
 }

you can see that form id is correct.
It is the same problem with FeedBackPanel errorMsg : I get a null pointer
when I try to get it with modalWindow.get("errorMsg");





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



Re: problem to test form in modal window with wicket tester

2011-05-26 Thread Mathilde Pellerin
It's fix : when I paste code to show you, I notice that login form is not
added in modal window but in ConnexionContentPanel...
So I try this code :
ModalWindowE4N modalWindow = (ModalWindowE4N)
tester.getComponentFromLastRenderedPage("modalConnexion");
ConnexionContentPanel loginPanel = (ConnexionContentPanel)
modalWindow.get(modalWindow.getContentId());
Form loginForm = (Form) loginPanel.get("loginForm");

FormTester formTester =
tester.newFormTester(loginForm.getPageRelativePath());

and it works.
Thanks for your help.



2011/5/26 Mathilde Pellerin 

>
>
> this is the code to construct modal window
> final ModalWindowE4N modalConnexion = new
> ModalWindowE4N("modalConnexion");
> modalConnexion.setTitle("Connexion à l'espace membre");
> modalConnexion.setContent(new
> ConnexionContentPanel(modalConnexion.getContentId()));
> add(modalConnexion);
>
> Form is added in ConnexionContentPanel :
> public ConnexionContentPanel(String id) {
> super(id);
>
> //Création du formulaire dont les champs seront liés aux champs
> d'un membre grace au model
> Form loginForm = new Form("loginForm",
> new CompoundPropertyModel(new
> LoadableDetachableModel() {
>
> @Override
> protected Membre load() {
> return new Membre();
> }
> }));
>
> //Création et ajout des champs id et pwd au formulaire
> TextField idField = new TextField("membreId");
> idField.setRequired(true);
> loginForm.add(idField);
>
> PasswordTextField pwdField = new PasswordTextField("password");
> pwdField.setRequired(true);
> loginForm.add(pwdField);
>
> //Ajout d'un du feedback panel qui contiendra les erreurs relevées
> par le formulaire
> final FeedbackPanel feedBackPanel = new FeedbackPanel("errorMsg");
> feedBackPanel.setOutputMarkupId(true);
> add(feedBackPanel);
>
> //création du bouton ajax pour soumettre le formulaire
> AjaxButton submitbutton = new AjaxButton("ajaxSubmitLogin") {
>
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form form)
> {
> Membre modelObject = (Membre) form.getModelObject();
> Membre membre;
>
> membre = serviceIdentif.identifier(modelObject.getId(),
> modelObject.getPassword());
> if(membre == null)
> error("Identifiant ou mot de passe incorrect");
> else
> setResponsePage(TableauBordPage.class);
> }
>
> @Override
> protected void onError(AjaxRequestTarget target, Form form)
> {
> target.addComponent(feedBackPanel);
> }
> };
> loginForm.add(submitbutton);
>
> //ajout du formulaire au panel
> add(loginForm);
> }
>
> you can see that form id is correct.
> It is the same problem with FeedBackPanel errorMsg : I get a null pointer
> when I try to get it with modalWindow.get("errorMsg");
>
>
>
>
>
>
>
> 2011/5/26 Andrea Del Bene 
>
>> Hi Mathilde,
>>
>> maybe the form id you use in test is not correct. How do you add form to
>> modalWindow? Can you attach code?
>>
>>
>>
>>
>>  Hi all,
>>>
>>> I have a modal window with a login form inside that works fine when I
>>> test
>>> it manually.
>>> I try to test it with wicket tester since yesterday. I saw in some mails
>>> of
>>> this list that "there is nothing special in testing modal windows".
>>> I tried this :
>>>
>>> tester.startPage(AccueilPage.class);
>>> tester.clickLink("connexion");
>>>
>>> ModalWindowE4N modalWindow = (ModalWindowE4N)
>>> tester.getComponentFromLastRenderedPage("modalConnexion");
>>> tester.isVisible(modalWindow.getPageRelativePath() + ":" +
>>> modalWindow.getContentId());
>>>
>>> Form  loginForm = (Form) modalWindow.get("loginForm");
>>> Component feedbackPanel = modalWindow.get("errorMsg");
>>>
>>> FormTester formTester =
>>> tester.newFormTester(loginForm.getPageRelativePath() + ":" +
>>> loginForm.getId());
>>>
>>> but I have a java.

Re: problem to test form in modal window with wicket tester

2011-05-26 Thread Mathilde Pellerin
this is the code to construct modal window
final ModalWindowE4N modalConnexion = new
ModalWindowE4N("modalConnexion");
modalConnexion.setTitle("Connexion à l'espace membre");
modalConnexion.setContent(new
ConnexionContentPanel(modalConnexion.getContentId()));
add(modalConnexion);

Form is added in ConnexionContentPanel :
public ConnexionContentPanel(String id) {
super(id);

//Création du formulaire dont les champs seront liés aux champs d'un
membre grace au model
Form loginForm = new Form("loginForm",
new CompoundPropertyModel(new
LoadableDetachableModel() {

@Override
protected Membre load() {
return new Membre();
}
}));

//Création et ajout des champs id et pwd au formulaire
TextField idField = new TextField("membreId");
idField.setRequired(true);
loginForm.add(idField);

PasswordTextField pwdField = new PasswordTextField("password");
pwdField.setRequired(true);
loginForm.add(pwdField);

//Ajout d'un du feedback panel qui contiendra les erreurs relevées
par le formulaire
final FeedbackPanel feedBackPanel = new FeedbackPanel("errorMsg");
feedBackPanel.setOutputMarkupId(true);
add(feedBackPanel);

//création du bouton ajax pour soumettre le formulaire
AjaxButton submitbutton = new AjaxButton("ajaxSubmitLogin") {

@Override
protected void onSubmit(AjaxRequestTarget target, Form form)
{
Membre modelObject = (Membre) form.getModelObject();
Membre membre;

membre = serviceIdentif.identifier(modelObject.getId(),
modelObject.getPassword());
if(membre == null)
error("Identifiant ou mot de passe incorrect");
else
setResponsePage(TableauBordPage.class);
}

@Override
protected void onError(AjaxRequestTarget target, Form form) {
target.addComponent(feedBackPanel);
}
};
loginForm.add(submitbutton);

//ajout du formulaire au panel
add(loginForm);
}

you can see that form id is correct.
It is the same problem with FeedBackPanel errorMsg : I get a null pointer
when I try to get it with modalWindow.get("errorMsg");






2011/5/26 Andrea Del Bene 

> Hi Mathilde,
>
> maybe the form id you use in test is not correct. How do you add form to
> modalWindow? Can you attach code?
>
>
>
>
>  Hi all,
>>
>> I have a modal window with a login form inside that works fine when I test
>> it manually.
>> I try to test it with wicket tester since yesterday. I saw in some mails
>> of
>> this list that "there is nothing special in testing modal windows".
>> I tried this :
>>
>> tester.startPage(AccueilPage.class);
>> tester.clickLink("connexion");
>>
>> ModalWindowE4N modalWindow = (ModalWindowE4N)
>> tester.getComponentFromLastRenderedPage("modalConnexion");
>> tester.isVisible(modalWindow.getPageRelativePath() + ":" +
>> modalWindow.getContentId());
>>
>> Form  loginForm = (Form) modalWindow.get("loginForm");
>> Component feedbackPanel = modalWindow.get("errorMsg");
>>
>> FormTester formTester =
>> tester.newFormTester(loginForm.getPageRelativePath() + ":" +
>> loginForm.getId());
>>
>> but I have a java.lang.NullPointerException on loginForm (and
>> feedbackPanel
>> is also null).
>> I begin with Wiket and I really don't understand why it doesn't work.
>> What am I doing wrong?
>>
>> Thanks
>> Mathilde
>>
>>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
 Mathilde Pellerin  Ingénieur en Génie Logiciel  Tél mobile :
06.60.78.79.03   E-mail
: mathilde.pelle...@gmail.com   Mon CV en ligne :
<http://www.mathilde-pellerin.fr/> http://www.mathilde-pellerin.fr/Mes
liens :  <http://www.viadeo.com/fr/profile/mathilde.pellerin>
<http://fr.linkedin.com/in/mathildepellerin>


Re: problem to test form in modal window with wicket tester

2011-05-26 Thread Andrea Del Bene

Hi Mathilde,

maybe the form id you use in test is not correct. How do you add form to 
modalWindow? Can you attach code?





Hi all,

I have a modal window with a login form inside that works fine when I test
it manually.
I try to test it with wicket tester since yesterday. I saw in some mails of
this list that "there is nothing special in testing modal windows".
I tried this :

 tester.startPage(AccueilPage.class);
 tester.clickLink("connexion");

 ModalWindowE4N modalWindow = (ModalWindowE4N)
tester.getComponentFromLastRenderedPage("modalConnexion");
 tester.isVisible(modalWindow.getPageRelativePath() + ":" +
modalWindow.getContentId());

 Form  loginForm = (Form) modalWindow.get("loginForm");
 Component feedbackPanel = modalWindow.get("errorMsg");

 FormTester formTester =
tester.newFormTester(loginForm.getPageRelativePath() + ":" +
loginForm.getId());

but I have a java.lang.NullPointerException on loginForm (and feedbackPanel
is also null).
I begin with Wiket and I really don't understand why it doesn't work.
What am I doing wrong?

Thanks
Mathilde




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



problem to test form in modal window with wicket tester

2011-05-26 Thread Mathilde Pellerin
Hi all,

I have a modal window with a login form inside that works fine when I test
it manually.
I try to test it with wicket tester since yesterday. I saw in some mails of
this list that "there is nothing special in testing modal windows".
I tried this :

tester.startPage(AccueilPage.class);
tester.clickLink("connexion");

ModalWindowE4N modalWindow = (ModalWindowE4N)
tester.getComponentFromLastRenderedPage("modalConnexion");
tester.isVisible(modalWindow.getPageRelativePath() + ":" +
modalWindow.getContentId());

Form loginForm = (Form) modalWindow.get("loginForm");
Component feedbackPanel = modalWindow.get("errorMsg");

FormTester formTester =
tester.newFormTester(loginForm.getPageRelativePath() + ":" +
loginForm.getId());

but I have a java.lang.NullPointerException on loginForm (and feedbackPanel
is also null).
I begin with Wiket and I really don't understand why it doesn't work.
What am I doing wrong?

Thanks
Mathilde


Re: Disabling serialization in wicket tester....

2010-08-01 Thread Erik Brakkee
On Sun, Aug 1, 2010 at 5:11 AM, Kent Tong  wrote
> I would like very much to disable serialization in wicket tester. I
> am using pages with mockito mocks that are not serializable (and why
> should they in a unit test). I am using workarounds now.

You can take a look at http://wicketpagetest.sourceforge.net which
> allows you to inject non-serializable mocks into your pages.


I have already solve the problem myself now using a SerializableProxyFactory
which creates serializable proxies for a mock:

http://utils.wamblee.org/support/general/apidocs/org/wamblee/general/SerializableProxyFactory.html

Will also have a look at the library you are suggesting.





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


Re: Disabling serialization in wicket tester....

2010-07-31 Thread Kent Tong

> I would like very much to disable serialization in wicket tester. I
> am using pages with mockito mocks that are not serializable (and why
> should they in a unit test). I am using workarounds now.

You can take a look at http://wicketpagetest.sourceforge.net which
allows you to inject non-serializable mocks into your pages.


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



Re: Disabling serialization in wicket tester....

2010-07-31 Thread James Carman
Will mockito let you mock more than one class at once?   If so, you can add
Serializable to the list.

On Jul 31, 2010 5:40 PM, "Erik Brakkee"  wrote:
> That my tests will not be equivalent is no big problem. In this case I am
> really unit testing the pages while mocking the backend. That allows me to
> also test anomalous behavior of the backend.
>
> In addition, I am also doing unit integration testing with rendering
wicket
> pages with an actual JPA backend with a relatively complete environment
> including transactions and JPA. So, overall my unit tests cover the
> functionality quite well.
>
> The trick I am doing now is storing the mock in a static variable of the
> test class and then creating a serializable proxy using LookupProxyFactory
(
>
http://utils.wamblee.org/support/general/apidocs/org/wamblee/general/LookupProxyFactory.html
)
> to lookup the mock dynamically. I guess this is screaming again for
another
> test utility on top of mockito for creating serializable mocks (if I
cannot
> solve it in wicket).
>
> Any suggestions on how to disable serialization in wicket tester?


Re: Disabling serialization in wicket tester....

2010-07-31 Thread Erik Brakkee
That my tests will not be equivalent is no big problem. In this case I am
really unit testing the pages while mocking the backend. That allows me to
also test anomalous behavior of the backend.

In addition, I am also doing unit integration testing with rendering wicket
pages with an actual JPA backend with a relatively complete environment
including transactions and JPA. So, overall my unit tests cover the
functionality quite well.

The trick I am doing now is storing the mock in a static variable of the
test class and then creating a serializable proxy using LookupProxyFactory (
http://utils.wamblee.org/support/general/apidocs/org/wamblee/general/LookupProxyFactory.html)
to lookup the mock dynamically. I guess this is screaming again for another
test utility on top of mockito for creating serializable mocks (if I cannot
solve it in wicket).

Any suggestions on how to disable serialization in wicket tester?


Re: Disabling serialization in wicket tester....

2010-07-31 Thread Martin Makundi
Your tests will not be equivalent ..

**
Martin

2010/8/1 Erik Brakkee :
> Hi,
>
>
> I would like very much to disable serialization in wicket tester. I am using
> pages with mockito mocks that are not serializable (and why should they in a
> unit test). I am using workarounds now.
>
> Is there an easy way in wicket tester to disable the serializations that
> occur?
>
> Cheers
>  Erik
>

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



Disabling serialization in wicket tester....

2010-07-31 Thread Erik Brakkee
Hi,


I would like very much to disable serialization in wicket tester. I am using
pages with mockito mocks that are not serializable (and why should they in a
unit test). I am using workarounds now.

Is there an easy way in wicket tester to disable the serializations that
occur?

Cheers
  Erik


Re: wicket tester failing in CI but not locally

2010-05-18 Thread Igor Vaynberg
if you want the tests to run in parallel you have to create a wicket
tester inside every test method instead of just once per class. that
way the threadlocal is set into every thread.

-igor

On Tue, May 18, 2010 at 1:49 AM, Douglas Ferguson
 wrote:
> The problem is not a hudson problem.
>
> The problem is that wicket tester tests do not want to be run in parallel.
>
> D/
>
> On May 18, 2010, at 2:38 AM, Per Newgro wrote:
>
>> Sorry but more i can't do. Im not an hudson user.
>>
>> Cheers
>> Per
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Douglas Ferguson
The problem is not a hudson problem.

The problem is that wicket tester tests do not want to be run in parallel.

D/

On May 18, 2010, at 2:38 AM, Per Newgro wrote:

> Sorry but more i can't do. Im not an hudson user.
> 
> Cheers
> Per
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


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



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Per Newgro

Sorry but more i can't do. Im not an hudson user.

Cheers
Per

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



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Douglas Ferguson
No.. I realized that the tests are running in parallel on hudson but from 
eclipse.

Since the application is bound to a thread local, then it fails.

D/

On May 18, 2010, at 2:18 AM, Per Newgro wrote:

> Is it the working solution?
> 
> Cheers
> Per
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


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



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Per Newgro

Is it the working solution?

Cheers
Per

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



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Per Newgro

Upps, sorry. Didn't recognized guice.

I would try to add it appropriatly to this way

public  class  MyApplicationextends  WebApplication{
protected  void  init()  {
addComponentInstantiationListener(
new  GuiceComponentInjector(this, getModule())
);
}

private  Module getModule()  {
return  new  Module()  {
public  void  configure(Binder binder)  {
binder.bind(IService.class).to(Service.class);
}
};
}
}

Cheers
Per




Re: wicket tester failing in CI but not locally

2010-05-18 Thread Douglas Ferguson
I just did this:

 tester.getApplication().addComponentInstantiationListener(new 
GuiceComponentInjector(tester.getApplication()));


On May 18, 2010, at 2:01 AM, Douglas Ferguson wrote:

> I'm not using spring. Would I still use that injector?
> 
> I'm using guice..
> 
> D/
> 
> 
> On May 18, 2010, at 1:46 AM, Per Newgro wrote:
> 
>> Someone seems to change this, but i dodn't found an example how to solve 
>> it correctly until now.
>> 
>> Kim had the problem some days ago to. Seems that yoiu have to add 
>> ComponentInstListener to TestApplication to.
>> Why this was working before and not anymore - i don't know.
>> Here is what he wrote
>> 
>> Okay,
>> 
>> Got my test green:-)
>> 
>> 
>> Here it is:
>> 
>> package be.thomascook.ui.pages.admin;
>> 
>> import be.thomascook.wicket.component.WicketFilter;
>> import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
>> import org.apache.wicket.util.tester.WicketTester;
>> import org.springframework.beans.factory.annotation.Autowired;
>> import org.springframework.context.ApplicationContext;
>> import org.springframework.test.context.ContextConfiguration;
>> import 
>> org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
>> import 
>> org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
>> import org.springframework.transaction.annotation.Transactional;
>> import org.testng.annotations.Test;
>> 
>> /**
>> * @author Compi
>> * @since 10-mei-2010
>> */
>> @ContextConfiguration(locations = {
>>"/applicationContext-dao.xml",
>>"/applicationContext-service.xml",
>>"/applicationContext-database.xml"})
>> @Transactional
>> public class UserListPageTest extends 
>> AbstractTransactionalTestNGSpringContextTests {
>> 
>>@Autowired
>>private ApplicationContext applicationContext;
>>@Autowired
>>protected WicketFilter wicketApplication;
>> 
>>@Test
>>public void labelContainsHelloWorld()   {
>>WicketTester tester=new WicketTester();
>>tester.getApplication().addComponentInstantiationListener(new 
>> SpringComponentInjector(tester.getApplication(), applicationContext, true ));
>> 
>> 
>>tester.startPage(UserListPage.class);
>>tester.assertNoErrorMessage();
>>tester.assertLabel("title", "Users List");
>>}
>> }
>> 
>> 
>> Kind regards,
>> Kim
>> 
>> 
>> 
>> 
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


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



Re: wicket tester failing in CI but not locally

2010-05-18 Thread Douglas Ferguson
I'm not using spring. Would I still use that injector?

I'm using guice..

D/


On May 18, 2010, at 1:46 AM, Per Newgro wrote:

> Someone seems to change this, but i dodn't found an example how to solve 
> it correctly until now.
> 
> Kim had the problem some days ago to. Seems that yoiu have to add 
> ComponentInstListener to TestApplication to.
> Why this was working before and not anymore - i don't know.
> Here is what he wrote
> 
> Okay,
> 
> Got my test green:-)
> 
> 
> Here it is:
> 
> package be.thomascook.ui.pages.admin;
> 
> import be.thomascook.wicket.component.WicketFilter;
> import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
> import org.apache.wicket.util.tester.WicketTester;
> import org.springframework.beans.factory.annotation.Autowired;
> import org.springframework.context.ApplicationContext;
> import org.springframework.test.context.ContextConfiguration;
> import 
> org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
> import 
> org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
> import org.springframework.transaction.annotation.Transactional;
> import org.testng.annotations.Test;
> 
> /**
>  * @author Compi
>  * @since 10-mei-2010
>  */
> @ContextConfiguration(locations = {
> "/applicationContext-dao.xml",
> "/applicationContext-service.xml",
> "/applicationContext-database.xml"})
> @Transactional
> public class UserListPageTest extends 
> AbstractTransactionalTestNGSpringContextTests {
> 
> @Autowired
> private ApplicationContext applicationContext;
> @Autowired
> protected WicketFilter wicketApplication;
> 
> @Test
> public void labelContainsHelloWorld()   {
> WicketTester tester=new WicketTester();
> tester.getApplication().addComponentInstantiationListener(new 
> SpringComponentInjector(tester.getApplication(), applicationContext, true ));
> 
> 
> tester.startPage(UserListPage.class);
> tester.assertNoErrorMessage();
> tester.assertLabel("title", "Users List");
> }
> }
> 
> 
> Kind regards,
> Kim
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
> 


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



Re: wicket tester failing in CI but not locally

2010-05-17 Thread Per Newgro
Someone seems to change this, but i dodn't found an example how to solve 
it correctly until now.


Kim had the problem some days ago to. Seems that yoiu have to add 
ComponentInstListener to TestApplication to.

Why this was working before and not anymore - i don't know.
Here is what he wrote

Okay,

Got my test green:-)


Here it is:

package be.thomascook.ui.pages.admin;

import be.thomascook.wicket.component.WicketFilter;
import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
import org.apache.wicket.util.tester.WicketTester;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import 
org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
import org.springframework.transaction.annotation.Transactional;
import org.testng.annotations.Test;

/**
 * @author Compi
 * @since 10-mei-2010
 */
@ContextConfiguration(locations = {
"/applicationContext-dao.xml",
"/applicationContext-service.xml",
"/applicationContext-database.xml"})
@Transactional
public class UserListPageTest extends 
AbstractTransactionalTestNGSpringContextTests {

@Autowired
private ApplicationContext applicationContext;
@Autowired
protected WicketFilter wicketApplication;

@Test
public void labelContainsHelloWorld()   {
WicketTester tester=new WicketTester();
tester.getApplication().addComponentInstantiationListener(new 
SpringComponentInjector(tester.getApplication(), applicationContext, true ));


tester.startPage(UserListPage.class);
tester.assertNoErrorMessage();
tester.assertLabel("title", "Users List");
}
}


Kind regards,
Kim




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



wicket tester failing in CI but not locally

2010-05-17 Thread Douglas Ferguson
My tests are running fine from eclipse but I get this when they are kicked off 
in hudson..

testLoadPanel_AddNewPerson(com.conducive.wicketTester.PersonAddOrEditTest_Wicket)
  Time elapsed: 0.001 sec  <<< ERROR!
org.apache.wicket.WicketRuntimeException: There is no application attached to 
current thread org.junit.runners.Suite
at org.apache.wicket.Application.get(Application.java:179)
at 
org.apache.wicket.injection.web.InjectorHolder.getInjector(InjectorHolder.java:67)
at 
com.conducive.wicket.PRManagerRequestCycle.(PRManagerRequestCycle.java:57)
at 
com.conducive.wicket.PRManagerApplication.newRequestCycle(PRManagerApplication.java:539)
at 
org.apache.wicket.protocol.http.MockWebApplication.createRequestCycle(MockWebApplication.java:652)
at 
org.apache.wicket.protocol.http.MockWebApplication.setupRequestAndResponse(MockWebApplication.java:687)
at 
org.apache.wicket.protocol.http.MockWebApplication.setupRequestAndResponse(MockWebApplication.java:706)
at 
org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:424)
at 
org.apache.wicket.protocol.http.MockWebApplication.processRequestCycle(MockWebApplication.java:410)
at 
org.apache.wicket.util.tester.BaseWicketTester.startPage(BaseWicketTester.java:306)
at 
com.conducive.wicketTester.PRManagerTestBase.loginUser(PRManagerTestBase.java:138)
at 
com.conducive.wicketTester.PRManagerTestBase.loginUser(PRManagerTestBase.java:153)
at 
com.conducive.wicketTester.PersonAddOrEditTest_Wicket.testLoadPanel_AddNewPerson(PersonAddOrEditTest_Wicket.java:16)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:24)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at 
org.jdogma.junit.NonBlockingAsynchronousRunner$1.call(NonBlockingAsynchronousRunner.java:59)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)



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



Re: Wicket Tester

2010-03-31 Thread svantepower

lol why didnt I see that.
must be the lack of coffe ;)

Thanks for your help!
-- 
View this message in context: 
http://old.nabble.com/Wicket-Tester-tp28094649p28094705.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Wicket Tester

2010-03-31 Thread Martin Makundi
Hi!

You must create wickettester with your application.

wickettester = new WicketTester(new MyApplication());


2010/3/31 Svante Reutland :
>
> Hi!im trying to run wicket tester on my application. but I cannot get it to 
> work.this is what I have done so far:
> WicketTester tester = new WicketTester();               
> tester.startPage(Login.class);                  FormTester formTester = 
> tester.newFormTester("loginForm");                      
> formTester.setValue("username", "admin");               
> formTester.setValue("password", "password");                    
> formTester.submit();
> and it gives me an error: cant instantiate constructor and " 
> org.apache.wicket.protocol.http.WebSession cannot be cast to 
> se.project.ui.MySession"
> anyone have any experience with Wicket tester?
> Best RegardsSvante
> _
> Mejla på krogen! Hotmail i mobilen.
> http://new.windowslivemobile.msn.com/SE-SE/windows-live-hotmail/default.aspx

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



Wicket Tester

2010-03-31 Thread Svante Reutland

Hi!im trying to run wicket tester on my application. but I cannot get it to 
work.this is what I have done so far:
WicketTester tester = new WicketTester();   
tester.startPage(Login.class);  FormTester formTester = 
tester.newFormTester("loginForm");  
formTester.setValue("username", "admin");   
formTester.setValue("password", "password");
formTester.submit();
and it gives me an error: cant instantiate constructor and " 
org.apache.wicket.protocol.http.WebSession cannot be cast to 
se.project.ui.MySession"
anyone have any experience with Wicket tester?
Best RegardsSvante
_
Mejla på krogen! Hotmail i mobilen. 
http://new.windowslivemobile.msn.com/SE-SE/windows-live-hotmail/default.aspx

Re: wicket tester & forms

2010-01-05 Thread Paul Szulc
I found more such problems. All described here:

http://paulszulc.wordpress.com/2009/08/03/wicket-testing-pitfalls-and-api-issues/

On Wed, Jan 6, 2010 at 7:28 AM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

> With quickstart example that can reproduce the problem
>
> 2010/1/6 Martin Makundi :
> > Report in jira
> >
> > 2010/1/6 Douglas Ferguson :
> >> I just found an issue in wicket tester.
> >>
> >> If you submit a form with hidden fields it will attempt to set the
> models on those hidden fields.
> >>
> >> My app depends on this.
> >>
> >> D/
> >>
> >>
> >> -
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Best regards,
Paul Szulc

http://paulszulc.wordpress.com


Re: wicket tester & forms

2010-01-05 Thread Martin Makundi
With quickstart example that can reproduce the problem

2010/1/6 Martin Makundi :
> Report in jira
>
> 2010/1/6 Douglas Ferguson :
>> I just found an issue in wicket tester.
>>
>> If you submit a form with hidden fields it will attempt to set the models on 
>> those hidden fields.
>>
>> My app depends on this.
>>
>> D/
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>

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



Re: wicket tester & forms

2010-01-05 Thread Martin Makundi
Report in jira

2010/1/6 Douglas Ferguson :
> I just found an issue in wicket tester.
>
> If you submit a form with hidden fields it will attempt to set the models on 
> those hidden fields.
>
> My app depends on this.
>
> D/
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



wicket tester & forms

2010-01-05 Thread Douglas Ferguson
I just found an issue in wicket tester.

If you submit a form with hidden fields it will attempt to set the models on 
those hidden fields.

My app depends on this.

D/


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



Re: Wicket tester & login pages

2010-01-04 Thread Pierre Goupil
OK! On which object? Is there a way to do: setAuthenticated(true)? <:^-)


On Mon, Jan 4, 2010 at 12:44 PM, Martijn Dashorst <
martijn.dasho...@gmail.com> wrote:

> You probably store the credentials (or isAuthenticated() == true) in
> the session. Just set the credentials *on* your session during
> testing.
>
> Martijn
>
> On Mon, Jan 4, 2010 at 12:32 PM, Pierre Goupil 
> wrote:
> > Hello all,
> >
> > Is there a way to access directly a page in Wicket tester? I mean:
> > by-passing the login page in order not to execute the whole workflow
> leading
> > to a certain page.
> >
> > We use, of course, @AuthorizedInstantiation-based login. We've found
> > examples where people provide directly the credentials to the login form
> and
> > then browse to the desired page, but I was wondering whether something
> more
> > "direct" existed.
> >
> > Regards,
> >
> > Pierre
> >
> >
> > --
> > Ad augusta per angusta
> >
> > Des résultats grandioses par des voies étroites
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.4 increases type safety for web applications
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Ad augusta per angusta

Des résultats grandioses par des voies étroites


Re: Wicket tester & login pages

2010-01-04 Thread Martijn Dashorst
You probably store the credentials (or isAuthenticated() == true) in
the session. Just set the credentials *on* your session during
testing.

Martijn

On Mon, Jan 4, 2010 at 12:32 PM, Pierre Goupil  wrote:
> Hello all,
>
> Is there a way to access directly a page in Wicket tester? I mean:
> by-passing the login page in order not to execute the whole workflow leading
> to a certain page.
>
> We use, of course, @AuthorizedInstantiation-based login. We've found
> examples where people provide directly the credentials to the login form and
> then browse to the desired page, but I was wondering whether something more
> "direct" existed.
>
> Regards,
>
> Pierre
>
>
> --
> Ad augusta per angusta
>
> Des résultats grandioses par des voies étroites
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.4

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



Re: Wicket tester & login pages

2010-01-04 Thread Pierre Goupil
We use @AuthorizedInstantiation. But what we're looking for is not a way to
inject the credentials but rather a way to access directly a protected page
in unit tests.

We know how to provide credentials and browse to the page but find it
dangerous: what if the credentials change, what if the Website layout
changes... ?

Regards,

Pierre



On Mon, Jan 4, 2010 at 12:36 PM, Martin Makundi <
martin.maku...@koodaripalvelut.com> wrote:

> Hi!
>
> Depends on your login but ofcourse wicket is a whitebox so you can
> inject any credentials you want. But visit the login page first to
> create session.
>
> **
> Martin
>
> 2010/1/4 Pierre Goupil :
> > Hello all,
> >
> > Is there a way to access directly a page in Wicket tester? I mean:
> > by-passing the login page in order not to execute the whole workflow
> leading
> > to a certain page.
> >
> > We use, of course, @AuthorizedInstantiation-based login. We've found
> > examples where people provide directly the credentials to the login form
> and
> > then browse to the desired page, but I was wondering whether something
> more
> > "direct" existed.
> >
> > Regards,
> >
> > Pierre
> >
> >
> > --
> > Ad augusta per angusta
> >
> > Des résultats grandioses par des voies étroites
> >
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Ad augusta per angusta

Des résultats grandioses par des voies étroites


Re: Wicket tester & login pages

2010-01-04 Thread Martin Makundi
Hi!

Depends on your login but ofcourse wicket is a whitebox so you can
inject any credentials you want. But visit the login page first to
create session.

**
Martin

2010/1/4 Pierre Goupil :
> Hello all,
>
> Is there a way to access directly a page in Wicket tester? I mean:
> by-passing the login page in order not to execute the whole workflow leading
> to a certain page.
>
> We use, of course, @AuthorizedInstantiation-based login. We've found
> examples where people provide directly the credentials to the login form and
> then browse to the desired page, but I was wondering whether something more
> "direct" existed.
>
> Regards,
>
> Pierre
>
>
> --
> Ad augusta per angusta
>
> Des résultats grandioses par des voies étroites
>

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



Wicket tester & login pages

2010-01-04 Thread Pierre Goupil
Hello all,

Is there a way to access directly a page in Wicket tester? I mean:
by-passing the login page in order not to execute the whole workflow leading
to a certain page.

We use, of course, @AuthorizedInstantiation-based login. We've found
examples where people provide directly the credentials to the login form and
then browse to the desired page, but I was wondering whether something more
"direct" existed.

Regards,

Pierre


-- 
Ad augusta per angusta

Des résultats grandioses par des voies étroites


Re: Wicket tester test coverage

2009-12-01 Thread ZedroS Schwart
>
> If the element is not in a loop, just specify the HTML ID in the template.
> If it is in a loop, use xpath.

oh. Thanks :$

I thought wicket id were incremeting on request, meaning that even
without loop the same page loaded twice would end up with a different
id (with an incremented number).

I should test it !

>
>
> zedros wrote:
>>
>> on a broader picture, my main question was about the way you proceed,
>> Do you test every page, including every validator or.. ? If doing so,
>> for pages that quite often are then not touched much, i would fear the
>> time needed for proper testing quite hard to justify. Am i wrong here
>> ?
>
> I test my code based on risk. If it is the code that is frequently use, has
> a high impact if it breaks, or is likely to contain bugs, I'll test it more
> thoroughly.

ok, thanks for this explanation :)

have a good day

zedros

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



Re: Wicket tester test coverage

2009-11-27 Thread Kent Tong



zedros wrote:
> 
> I saw it, but we're using guice (when, it wouldn't be a show stopper
> in the end). Still, on the technical side, there's also this issue
> with selenium using mostly id, whereas wicket'ids change with each
> request... How do you solve this issue ?
> 

If the element is not in a loop, just specify the HTML ID in the template. 
If it is in a loop, use xpath.


zedros wrote:
> 
> on a broader picture, my main question was about the way you proceed,
> Do you test every page, including every validator or.. ? If doing so,
> for pages that quite often are then not touched much, i would fear the
> time needed for proper testing quite hard to justify. Am i wrong here
> ?

I test my code based on risk. If it is the code that is frequently use, has
a high impact if it breaks, or is likely to contain bugs, I'll test it more 
thoroughly.


-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
-- 
View this message in context: 
http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26541425.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Wicket tester test coverage

2009-11-25 Thread ZedroS Schwart
>
> Without reference to his article, I can only guess that it may be pointless
> to test the position or the color of a button in automated tests.

I think it was this one :
http://www.infoq.com/news/2009/11/uncle-bob-tdd-applicability
but in fact uncle bob mainly says it's pointless to do TDD when not
knowing where it'll end, but still one should then write the tests
afterwards.

> On the
> other hand, functionality of GUI can definitely be tested. For example,
> I am writing a Wicket application with TDD (sort of) with the library shown
> in my signature. It is working very well.

I saw it, but we're using guice (when, it wouldn't be a show stopper
in the end). Still, on the technical side, there's also this issue
with selenium using mostly id, whereas wicket'ids change with each
request... How do you solve this issue ?

on a broader picture, my main question was about the way you proceed,
Do you test every page, including every validator or.. ? If doing so,
for pages that quite often are then not touched much, i would fear the
time needed for proper testing quite hard to justify. Am i wrong here
?

bye
zedros


>
>
> -
> --
> Kent Tong
> Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
> --
> View this message in context:
> http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26509652.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Re: Wicket tester test coverage

2009-11-25 Thread Pierre Goupil
No, it isn't but:

-with your solution, no test has to be written especially for each Component
/ Page (if one just want to check for exception)
-so we are assured that no Page / Component is forgotten (in the "check for
exception" process)) :-)



On Wed, Nov 25, 2009 at 10:40 AM, Daan van Etten  wrote:

> Item 2 (fail if a page has not been tested) is not in my solution, but
> I'm glad I could help :-)
>
> Regards,
>
> Daan van Etten
>
> On Wed, 2009-11-25 at 10:32 +0100, Pierre Goupil wrote:
> > Yeah, test coverage is a big word here. But as I said I was not looking
> for
> > a way to generate a report, just a mean to have my test suit fail if 1) a
> > page throws an exception at instantiation 2) a page has not been so
> tested.
> >
> > That's exactly what you did and I'm not surprised not to be the first one
> to
> > wonder how to achieve this.
> >
> > Of course this test is pretty basic, but as it's totally automated,
> that's
> > no big deal. You just have to know what is does and what its limits are.
> > Reading your blog, I see that I made the same assumptions than you
> regarding
> > that matter and that the need was the very same.
> >
> >
> >
> >
> >
> > On Wed, Nov 25, 2009 at 10:24 AM, Daan van Etten  wrote:
> >
> > > In my other post I gave a link to a full-fledged example which scans
> for
> > > Panel classes with the default constructor and instantiates them.
> > >
> > >
> > >
> http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup
> > >
> > > This has almost no value (in my opinion) for reporting unit testing
> > > coverage. It only checks for exceptions and if the code matches the
> > > markup at instantiation.
> > > An exception could easily be thrown when replacing panels, clicking on
> a
> > > link or submitting a form. This is not tested.
> > >
> > > Regards,
> > >
> > > Daan van Etten
> > >
> > > On Wed, 2009-11-25 at 10:06 +0100, Martijn Dashorst wrote:
> > > > Spring has a classpath scanner which you can copy and adapt to scan
> > > > for pages and then try to instantiate them. The problem is often that
> > > > pages don't have a default constructor, which is a problem if you
> want
> > > > to instantiate them automagically.
> > > >
> > > > Martijn
> > > >
> > > > On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil <
> goupilpie...@gmail.com>
> > > wrote:
> > > > > Guys,
> > > > >
> > > > > One thing that I like regarding Wicket tester is that it easily
> allows
> > > one
> > > > > to check a Page under design for any exception that it could throw
> at
> > > > > creation-time. Actually, doing such a basic test is for me
> essential,
> > > so as
> > > > > it takes only two lines of code, I systematically check all my
> pages
> > > this
> > > > > way.
> > > > >
> > > > > You know, the:
> > > > >
> > > > >// start and render the test page
> > > > >this.tester.startPage(HomePage.class);
> > > > >
> > > > >// assert rendered page class
> > > > >this.tester.assertRenderedPage(HomePage.class);
> > > > >
> > > > > thing.
> > > > >
> > > > > What I like so much with it is that any error which would occur
> when
> > > you
> > > > > load the page in FF / IE... occurs without leaving Eclipse and
> > > immediately.
> > > > > When the workflow to find the page in the browser is long and
> > > repetitive,
> > > > > it's a relief!
> > > > >
> > > > > BUT, when the number of pages grow, two related problems emerge:
> > > > >
> > > > > -you have to duplicate these two lines of code everytime, which is
> a
> > > (small)
> > > > > pain in itself
> > > > > -and you have no guarantee that you didn't forget any page, which
> is
> > > worst.
> > > > >
> > > > > So I'm looking for a way to list all Page instances in a Wicket
> app,
> > > which
> > > > > could then allow me to be sure that they are all covered by a test.
> And
> > > when
> > > > > it's done maybe I c

Re: Wicket tester test coverage

2009-11-25 Thread Daan van Etten
Item 2 (fail if a page has not been tested) is not in my solution, but
I'm glad I could help :-)

Regards,

Daan van Etten

On Wed, 2009-11-25 at 10:32 +0100, Pierre Goupil wrote:
> Yeah, test coverage is a big word here. But as I said I was not looking for
> a way to generate a report, just a mean to have my test suit fail if 1) a
> page throws an exception at instantiation 2) a page has not been so tested.
> 
> That's exactly what you did and I'm not surprised not to be the first one to
> wonder how to achieve this.
> 
> Of course this test is pretty basic, but as it's totally automated, that's
> no big deal. You just have to know what is does and what its limits are.
> Reading your blog, I see that I made the same assumptions than you regarding
> that matter and that the need was the very same.
> 
> 
> 
> 
> 
> On Wed, Nov 25, 2009 at 10:24 AM, Daan van Etten  wrote:
> 
> > In my other post I gave a link to a full-fledged example which scans for
> > Panel classes with the default constructor and instantiates them.
> >
> >
> > http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup
> >
> > This has almost no value (in my opinion) for reporting unit testing
> > coverage. It only checks for exceptions and if the code matches the
> > markup at instantiation.
> > An exception could easily be thrown when replacing panels, clicking on a
> > link or submitting a form. This is not tested.
> >
> > Regards,
> >
> > Daan van Etten
> >
> > On Wed, 2009-11-25 at 10:06 +0100, Martijn Dashorst wrote:
> > > Spring has a classpath scanner which you can copy and adapt to scan
> > > for pages and then try to instantiate them. The problem is often that
> > > pages don't have a default constructor, which is a problem if you want
> > > to instantiate them automagically.
> > >
> > > Martijn
> > >
> > > On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil 
> > wrote:
> > > > Guys,
> > > >
> > > > One thing that I like regarding Wicket tester is that it easily allows
> > one
> > > > to check a Page under design for any exception that it could throw at
> > > > creation-time. Actually, doing such a basic test is for me essential,
> > so as
> > > > it takes only two lines of code, I systematically check all my pages
> > this
> > > > way.
> > > >
> > > > You know, the:
> > > >
> > > >// start and render the test page
> > > >this.tester.startPage(HomePage.class);
> > > >
> > > >// assert rendered page class
> > > >this.tester.assertRenderedPage(HomePage.class);
> > > >
> > > > thing.
> > > >
> > > > What I like so much with it is that any error which would occur when
> > you
> > > > load the page in FF / IE... occurs without leaving Eclipse and
> > immediately.
> > > > When the workflow to find the page in the browser is long and
> > repetitive,
> > > > it's a relief!
> > > >
> > > > BUT, when the number of pages grow, two related problems emerge:
> > > >
> > > > -you have to duplicate these two lines of code everytime, which is a
> > (small)
> > > > pain in itself
> > > > -and you have no guarantee that you didn't forget any page, which is
> > worst.
> > > >
> > > > So I'm looking for a way to list all Page instances in a Wicket app,
> > which
> > > > could then allow me to be sure that they are all covered by a test. And
> > when
> > > > it's done maybe I could use the same system in order to ensure that
> > Selenium
> > > > (the automated functional testing tool) has covered all my pages as
> > well
> > > > (more deeply).
> > > >
> > > > I could use a test coverage tool, but 1) it wouldn't work with Selenium
> > 2) I
> > > > don't want to generate a report, I want the test suit to fail if a Page
> > is
> > > > not covered by my test class.
> > > >
> > > > Could anyone suggest where to start, please?
> > > >
> > > > Regards,
> > > >
> > > > Pierre
> > > >
> > > >
> > > > --
> > > > Rien de grand ne s'est accompli dans le monde sans passion.
> > > >
> > > > (G.W.F. Hegel, philosophe allemand)
> > > >
> > >
> > >
> > >
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> 
> 


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



Re: Wicket tester test coverage

2009-11-25 Thread Pierre Goupil
Yeah, test coverage is a big word here. But as I said I was not looking for
a way to generate a report, just a mean to have my test suit fail if 1) a
page throws an exception at instantiation 2) a page has not been so tested.

That's exactly what you did and I'm not surprised not to be the first one to
wonder how to achieve this.

Of course this test is pretty basic, but as it's totally automated, that's
no big deal. You just have to know what is does and what its limits are.
Reading your blog, I see that I made the same assumptions than you regarding
that matter and that the need was the very same.





On Wed, Nov 25, 2009 at 10:24 AM, Daan van Etten  wrote:

> In my other post I gave a link to a full-fledged example which scans for
> Panel classes with the default constructor and instantiates them.
>
>
> http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup
>
> This has almost no value (in my opinion) for reporting unit testing
> coverage. It only checks for exceptions and if the code matches the
> markup at instantiation.
> An exception could easily be thrown when replacing panels, clicking on a
> link or submitting a form. This is not tested.
>
> Regards,
>
> Daan van Etten
>
> On Wed, 2009-11-25 at 10:06 +0100, Martijn Dashorst wrote:
> > Spring has a classpath scanner which you can copy and adapt to scan
> > for pages and then try to instantiate them. The problem is often that
> > pages don't have a default constructor, which is a problem if you want
> > to instantiate them automagically.
> >
> > Martijn
> >
> > On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil 
> wrote:
> > > Guys,
> > >
> > > One thing that I like regarding Wicket tester is that it easily allows
> one
> > > to check a Page under design for any exception that it could throw at
> > > creation-time. Actually, doing such a basic test is for me essential,
> so as
> > > it takes only two lines of code, I systematically check all my pages
> this
> > > way.
> > >
> > > You know, the:
> > >
> > >// start and render the test page
> > >this.tester.startPage(HomePage.class);
> > >
> > >// assert rendered page class
> > >this.tester.assertRenderedPage(HomePage.class);
> > >
> > > thing.
> > >
> > > What I like so much with it is that any error which would occur when
> you
> > > load the page in FF / IE... occurs without leaving Eclipse and
> immediately.
> > > When the workflow to find the page in the browser is long and
> repetitive,
> > > it's a relief!
> > >
> > > BUT, when the number of pages grow, two related problems emerge:
> > >
> > > -you have to duplicate these two lines of code everytime, which is a
> (small)
> > > pain in itself
> > > -and you have no guarantee that you didn't forget any page, which is
> worst.
> > >
> > > So I'm looking for a way to list all Page instances in a Wicket app,
> which
> > > could then allow me to be sure that they are all covered by a test. And
> when
> > > it's done maybe I could use the same system in order to ensure that
> Selenium
> > > (the automated functional testing tool) has covered all my pages as
> well
> > > (more deeply).
> > >
> > > I could use a test coverage tool, but 1) it wouldn't work with Selenium
> 2) I
> > > don't want to generate a report, I want the test suit to fail if a Page
> is
> > > not covered by my test class.
> > >
> > > Could anyone suggest where to start, please?
> > >
> > > Regards,
> > >
> > > Pierre
> > >
> > >
> > > --
> > > Rien de grand ne s'est accompli dans le monde sans passion.
> > >
> > > (G.W.F. Hegel, philosophe allemand)
> > >
> >
> >
> >
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Rien de grand ne s'est accompli dans le monde sans passion.

(G.W.F. Hegel, philosophe allemand)


Re: Wicket tester test coverage

2009-11-25 Thread Pierre Goupil
Sure. But from the beginning, I was looking for a way not to write the
famous 2 lines of code (see above) for each page and component.

I'll have a look for sure at your lib, the Selenium integration is
promising. :-)



On Wed, Nov 25, 2009 at 10:25 AM, Kent Tong  wrote:

>
>
>
> Pierre Goupil wrote:
> >
> > I use it, and what I'm looking for is a mean to ensure my test coverage.
> >
>
> If you're using TDD, you will have developed the page and the unit test for
> that
> page at the same time and by definition you won't have a page that is not
> tested.
>
> -
> --
> Kent Tong
> Better way to unit test Wicket pages (
> http://wicketpagetest.sourceforge.net)
> --
> View this message in context:
> http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26509669.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Rien de grand ne s'est accompli dans le monde sans passion.

(G.W.F. Hegel, philosophe allemand)


Re: Wicket tester test coverage

2009-11-25 Thread Kent Tong



Pierre Goupil wrote:
> 
> I use it, and what I'm looking for is a mean to ensure my test coverage.
> 

If you're using TDD, you will have developed the page and the unit test for
that 
page at the same time and by definition you won't have a page that is not 
tested.

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
-- 
View this message in context: 
http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26509669.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Wicket tester test coverage

2009-11-25 Thread Pierre Goupil
Ouch! It's exactly what my first point was trying to achieve. Thanx a lot!

Now, I'll have to adapt it to Selenium. I'll try & post it on your blog,
Daan.

Who said "TDD"?. I know that not so much is tested in this way be it's so
exhaustive (regarding the total number of Pages / Components to check) plus
it provide so fast feedback that I find it mandatory for whom wishes to do
TDD in Wicket.

Regards,

Pierre



On Wed, Nov 25, 2009 at 10:06 AM, Martijn Dashorst <
martijn.dasho...@gmail.com> wrote:

> Spring has a classpath scanner which you can copy and adapt to scan
> for pages and then try to instantiate them. The problem is often that
> pages don't have a default constructor, which is a problem if you want
> to instantiate them automagically.
>
> Martijn
>
> On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil 
> wrote:
> > Guys,
> >
> > One thing that I like regarding Wicket tester is that it easily allows
> one
> > to check a Page under design for any exception that it could throw at
> > creation-time. Actually, doing such a basic test is for me essential, so
> as
> > it takes only two lines of code, I systematically check all my pages this
> > way.
> >
> > You know, the:
> >
> >// start and render the test page
> >this.tester.startPage(HomePage.class);
> >
> >// assert rendered page class
> >this.tester.assertRenderedPage(HomePage.class);
> >
> > thing.
> >
> > What I like so much with it is that any error which would occur when you
> > load the page in FF / IE... occurs without leaving Eclipse and
> immediately.
> > When the workflow to find the page in the browser is long and repetitive,
> > it's a relief!
> >
> > BUT, when the number of pages grow, two related problems emerge:
> >
> > -you have to duplicate these two lines of code everytime, which is a
> (small)
> > pain in itself
> > -and you have no guarantee that you didn't forget any page, which is
> worst.
> >
> > So I'm looking for a way to list all Page instances in a Wicket app,
> which
> > could then allow me to be sure that they are all covered by a test. And
> when
> > it's done maybe I could use the same system in order to ensure that
> Selenium
> > (the automated functional testing tool) has covered all my pages as well
> > (more deeply).
> >
> > I could use a test coverage tool, but 1) it wouldn't work with Selenium
> 2) I
> > don't want to generate a report, I want the test suit to fail if a Page
> is
> > not covered by my test class.
> >
> > Could anyone suggest where to start, please?
> >
> > Regards,
> >
> > Pierre
> >
> >
> > --
> > Rien de grand ne s'est accompli dans le monde sans passion.
> >
> > (G.W.F. Hegel, philosophe allemand)
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.4 increases type safety for web applications
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Rien de grand ne s'est accompli dans le monde sans passion.

(G.W.F. Hegel, philosophe allemand)


Re: Wicket tester test coverage

2009-11-25 Thread Daan van Etten
In my other post I gave a link to a full-fledged example which scans for
Panel classes with the default constructor and instantiates them.

http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup

This has almost no value (in my opinion) for reporting unit testing
coverage. It only checks for exceptions and if the code matches the
markup at instantiation.
An exception could easily be thrown when replacing panels, clicking on a
link or submitting a form. This is not tested.

Regards,

Daan van Etten

On Wed, 2009-11-25 at 10:06 +0100, Martijn Dashorst wrote:
> Spring has a classpath scanner which you can copy and adapt to scan
> for pages and then try to instantiate them. The problem is often that
> pages don't have a default constructor, which is a problem if you want
> to instantiate them automagically.
> 
> Martijn
> 
> On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil  
> wrote:
> > Guys,
> >
> > One thing that I like regarding Wicket tester is that it easily allows one
> > to check a Page under design for any exception that it could throw at
> > creation-time. Actually, doing such a basic test is for me essential, so as
> > it takes only two lines of code, I systematically check all my pages this
> > way.
> >
> > You know, the:
> >
> >// start and render the test page
> >this.tester.startPage(HomePage.class);
> >
> >// assert rendered page class
> >this.tester.assertRenderedPage(HomePage.class);
> >
> > thing.
> >
> > What I like so much with it is that any error which would occur when you
> > load the page in FF / IE... occurs without leaving Eclipse and immediately.
> > When the workflow to find the page in the browser is long and repetitive,
> > it's a relief!
> >
> > BUT, when the number of pages grow, two related problems emerge:
> >
> > -you have to duplicate these two lines of code everytime, which is a (small)
> > pain in itself
> > -and you have no guarantee that you didn't forget any page, which is worst.
> >
> > So I'm looking for a way to list all Page instances in a Wicket app, which
> > could then allow me to be sure that they are all covered by a test. And when
> > it's done maybe I could use the same system in order to ensure that Selenium
> > (the automated functional testing tool) has covered all my pages as well
> > (more deeply).
> >
> > I could use a test coverage tool, but 1) it wouldn't work with Selenium 2) I
> > don't want to generate a report, I want the test suit to fail if a Page is
> > not covered by my test class.
> >
> > Could anyone suggest where to start, please?
> >
> > Regards,
> >
> > Pierre
> >
> >
> > --
> > Rien de grand ne s'est accompli dans le monde sans passion.
> >
> > (G.W.F. Hegel, philosophe allemand)
> >
> 
> 
> 


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



Re: Wicket tester test coverage

2009-11-25 Thread Kent Tong


zedros wrote:
> 
> I was under the assumption that unit testing isn't valuable for GUI,
> esp. web gui, since the effort is too important... I think I even read
> uncle bob saying so. How do you suggest to write/do TDD for web pages
> ?
> 

Without reference to his article, I can only guess that it may be pointless 
to test the position or the color of a button in automated tests.  On the
other hand, functionality of GUI can definitely be tested. For example,
I am writing a Wicket application with TDD (sort of) with the library shown
in my signature. It is working very well.


-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
-- 
View this message in context: 
http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26509652.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Re: Wicket tester test coverage

2009-11-25 Thread Martijn Dashorst
Spring has a classpath scanner which you can copy and adapt to scan
for pages and then try to instantiate them. The problem is often that
pages don't have a default constructor, which is a problem if you want
to instantiate them automagically.

Martijn

On Wed, Nov 25, 2009 at 12:57 AM, Pierre Goupil  wrote:
> Guys,
>
> One thing that I like regarding Wicket tester is that it easily allows one
> to check a Page under design for any exception that it could throw at
> creation-time. Actually, doing such a basic test is for me essential, so as
> it takes only two lines of code, I systematically check all my pages this
> way.
>
> You know, the:
>
>        // start and render the test page
>        this.tester.startPage(HomePage.class);
>
>        // assert rendered page class
>        this.tester.assertRenderedPage(HomePage.class);
>
> thing.
>
> What I like so much with it is that any error which would occur when you
> load the page in FF / IE... occurs without leaving Eclipse and immediately.
> When the workflow to find the page in the browser is long and repetitive,
> it's a relief!
>
> BUT, when the number of pages grow, two related problems emerge:
>
> -you have to duplicate these two lines of code everytime, which is a (small)
> pain in itself
> -and you have no guarantee that you didn't forget any page, which is worst.
>
> So I'm looking for a way to list all Page instances in a Wicket app, which
> could then allow me to be sure that they are all covered by a test. And when
> it's done maybe I could use the same system in order to ensure that Selenium
> (the automated functional testing tool) has covered all my pages as well
> (more deeply).
>
> I could use a test coverage tool, but 1) it wouldn't work with Selenium 2) I
> don't want to generate a report, I want the test suit to fail if a Page is
> not covered by my test class.
>
> Could anyone suggest where to start, please?
>
> Regards,
>
> Pierre
>
>
> --
> Rien de grand ne s'est accompli dans le monde sans passion.
>
> (G.W.F. Hegel, philosophe allemand)
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.4 increases type safety for web applications
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.4.0

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



Re: Wicket tester test coverage

2009-11-25 Thread Daan van Etten
Hi,

What you can do is scan all Page classes (or Panel classes, etc) on the
class-path and check if there are tests for them. 

Put this code in a unit test.
Fail the test if you find a class without accompanying test.

You can use this example to get started with the class path scanning:
http://stuq.nl/weblog/2009-11-01/automatically-test-your-wicket-panel-html-markup

Regards,

Daan van Etten

On Wed, 2009-11-25 at 09:23 +0100, Pierre Goupil wrote:
> I use it, and what I'm looking for is a mean to ensure my test coverage.
> 
> 
> On Wed, Nov 25, 2009 at 6:13 AM, Kent Tong  wrote:
> 
> >
> >
> >
> > Pierre Goupil wrote:
> > >
> > > So I'm looking for a way to list all Page instances in a Wicket app,
> > which
> > > could then allow me to be sure that they are all covered by a test. And
> > > when
> > > it's done maybe I could use the same system in order to ensure that
> > > Selenium
> > > (the automated functional testing tool) has covered all my pages as well
> > > (more deeply).
> > >
> >
> > What you need is TDD. Once you adopt TDD, you will have every page tested.
> >
> > -
> > --
> > Kent Tong
> > Better way to unit test Wicket pages (
> > http://wicketpagetest.sourceforge.net)
> > --
> > View this message in context:
> > http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26507647.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
> 
> 


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



Re: Wicket tester test coverage

2009-11-25 Thread Jeremy Thomerson
Use Cobertura or similar.  It will work for both your use cases and provide
you with coverage metrics.

--
Jeremy Thomerson
http://www.wickettraining.com



On Wed, Nov 25, 2009 at 2:23 AM, Pierre Goupil wrote:

> I use it, and what I'm looking for is a mean to ensure my test coverage.
>
>
> On Wed, Nov 25, 2009 at 6:13 AM, Kent Tong  wrote:
>
> >
> >
> >
> > Pierre Goupil wrote:
> > >
> > > So I'm looking for a way to list all Page instances in a Wicket app,
> > which
> > > could then allow me to be sure that they are all covered by a test. And
> > > when
> > > it's done maybe I could use the same system in order to ensure that
> > > Selenium
> > > (the automated functional testing tool) has covered all my pages as
> well
> > > (more deeply).
> > >
> >
> > What you need is TDD. Once you adopt TDD, you will have every page
> tested.
> >
> > -
> > --
> > Kent Tong
> > Better way to unit test Wicket pages (
> > http://wicketpagetest.sourceforge.net)
> > --
> > View this message in context:
> >
> http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26507647.html
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > -
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
>
> --
> Rien de grand ne s'est accompli dans le monde sans passion.
>
> (G.W.F. Hegel, philosophe allemand)
>


Re: Wicket tester test coverage

2009-11-25 Thread ZedroS Schwart
Hi Kent

On Wed, Nov 25, 2009 at 6:13 AM, Kent Tong  wrote:
> What you need is TDD. Once you adopt TDD, you will have every page tested.

I was under the assumption that unit testing isn't valuable for GUI,
esp. web gui, since the effort is too important... I think I even read
uncle bob saying so. How do you suggest to write/do TDD for web pages
?

thanks in advance

++
zedros

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



Re: Wicket tester test coverage

2009-11-25 Thread Pierre Goupil
I use it, and what I'm looking for is a mean to ensure my test coverage.


On Wed, Nov 25, 2009 at 6:13 AM, Kent Tong  wrote:

>
>
>
> Pierre Goupil wrote:
> >
> > So I'm looking for a way to list all Page instances in a Wicket app,
> which
> > could then allow me to be sure that they are all covered by a test. And
> > when
> > it's done maybe I could use the same system in order to ensure that
> > Selenium
> > (the automated functional testing tool) has covered all my pages as well
> > (more deeply).
> >
>
> What you need is TDD. Once you adopt TDD, you will have every page tested.
>
> -
> --
> Kent Tong
> Better way to unit test Wicket pages (
> http://wicketpagetest.sourceforge.net)
> --
> View this message in context:
> http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26507647.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Rien de grand ne s'est accompli dans le monde sans passion.

(G.W.F. Hegel, philosophe allemand)


Re: Wicket tester test coverage

2009-11-24 Thread Kent Tong



Pierre Goupil wrote:
> 
> So I'm looking for a way to list all Page instances in a Wicket app, which
> could then allow me to be sure that they are all covered by a test. And
> when
> it's done maybe I could use the same system in order to ensure that
> Selenium
> (the automated functional testing tool) has covered all my pages as well
> (more deeply).
> 

What you need is TDD. Once you adopt TDD, you will have every page tested.

-
--
Kent Tong
Better way to unit test Wicket pages (http://wicketpagetest.sourceforge.net)
-- 
View this message in context: 
http://old.nabble.com/Wicket-tester-test-coverage-tp26505428p26507647.html
Sent from the Wicket - User mailing list archive at Nabble.com.


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



Wicket tester test coverage

2009-11-24 Thread Pierre Goupil
Guys,

One thing that I like regarding Wicket tester is that it easily allows one
to check a Page under design for any exception that it could throw at
creation-time. Actually, doing such a basic test is for me essential, so as
it takes only two lines of code, I systematically check all my pages this
way.

You know, the:

// start and render the test page
this.tester.startPage(HomePage.class);

// assert rendered page class
this.tester.assertRenderedPage(HomePage.class);

thing.

What I like so much with it is that any error which would occur when you
load the page in FF / IE... occurs without leaving Eclipse and immediately.
When the workflow to find the page in the browser is long and repetitive,
it's a relief!

BUT, when the number of pages grow, two related problems emerge:

-you have to duplicate these two lines of code everytime, which is a (small)
pain in itself
-and you have no guarantee that you didn't forget any page, which is worst.

So I'm looking for a way to list all Page instances in a Wicket app, which
could then allow me to be sure that they are all covered by a test. And when
it's done maybe I could use the same system in order to ensure that Selenium
(the automated functional testing tool) has covered all my pages as well
(more deeply).

I could use a test coverage tool, but 1) it wouldn't work with Selenium 2) I
don't want to generate a report, I want the test suit to fail if a Page is
not covered by my test class.

Could anyone suggest where to start, please?

Regards,

Pierre


-- 
Rien de grand ne s'est accompli dans le monde sans passion.

(G.W.F. Hegel, philosophe allemand)


Re: Wicket tester mock server name

2009-11-04 Thread Igor Vaynberg
you can create your own subclass of mockhttpservletrequest and return
whatever you want. hooking it into wickettester should not be that
bad... if it is we can see if we can make it easier.

-igor

On Wed, Nov 4, 2009 at 8:27 AM, Ted Vinke  wrote:
> Hi!
>
> Seems a bit dumb I can't seem to get the following working. In my
> application I have to so something special based on the domain the app is
> running on. I ask for that domain in the following manner:
>
>   String serverName =
> getWebRequestCycle().getWebRequest().getHttpServletRequest().getServerName();
>   // serverName is e.g. 'www.somedomain.com'
>
> The problem: when testing in the Wicket tester serverName results in
> 'localhost'.
>
> How can I set / mock
> getWebRequestCycle().getWebRequest().getHttpServletRequest().getServerName()
> to return a preset value, such as 'www.somedomain.com',  when accessing my
> page in my unit test?
>
> Any tips or hints to examples are greatly appreciated!!
>
> Kind regards,
> Ted
>
> -
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

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



Wicket tester mock server name

2009-11-04 Thread Ted Vinke

Hi!

Seems a bit dumb I can't seem to get the following working. In my 
application I have to so something special based on the domain the app 
is running on. I ask for that domain in the following manner:


   String serverName = 
getWebRequestCycle().getWebRequest().getHttpServletRequest().getServerName();

   // serverName is e.g. 'www.somedomain.com'

The problem: when testing in the Wicket tester serverName results in 
'localhost'.


How can I set / mock 
getWebRequestCycle().getWebRequest().getHttpServletRequest().getServerName() 
to return a preset value, such as 'www.somedomain.com',  when accessing 
my page in my unit test?


Any tips or hints to examples are greatly appreciated!!

Kind regards,
Ted

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



  1   2   >