You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by wicket user <wi...@comley.org> on 2007/09/11 21:46:35 UTC

WicketTester and Page parameters & Wicket Example Unit tests?

Ok,

Two questions really:

1) I've got a page that gets hit by an outside credit card merchant once
they have validated the card, they post me my transaction ID along with a
whole host of other parameters. Getting them from the request is easy in the
page itself but trying to unit test it is driving me nuts. Basically I want
to start the page with parameters already loaded, it has to be staring me in
the face but I haven't had any luck.

2) Are there unit tests for all the examples that are on
http://wicketstuff.org/wicket13/ ? If they are available it would be nice to
have the ability of viewing the tests alongside the htm and source, that way
you can see how to build and break it at the same time. Unless of course I'm
the only one doing a combination of FDD/TDD?

Thanks again,
Simon

ps. I have been snooping around hoping to actually contribute more then
questions but all the easy ones are answered already :-)

Re: WicketTester and Page parameters & Wicket Example Unit tests?

Posted by wicket user <wi...@comley.org>.
No I hadn't!  ..... but I have now! Thanks so much.

If I had made a constructor that took PageParameters parameter I would have
obviously tried that but I never thought to look at the WebPage class and
see that there is a contructor: WebPage(PageParameters ) which you can
override.

Man that's made my testing a lot more simple now.

Thanks again
Simon

On 12/09/2007, cwilkes <cw...@ladro.com> wrote:
>
>
>
> wicket user wrote:
> >
> > 1) I've got a page that gets hit by an outside credit card merchant once
> > they have validated the card, they post me my transaction ID along with
> a
> > whole host of other parameters. Getting them from the request is easy in
> > the
> > page itself but trying to unit test it is driving me nuts. Basically I
> > want
> > to start the page with parameters already loaded, it has to be staring
> me
> > in
> > the face but I haven't had any luck.
> >
>
> Have you tried someething like this?
>
> PageParameters pageParameters = new PageParameters();
> pageParameters.add("userId", "1234");
> wicketTester.startPage(new ITestPageSource() {
>             public Page getTestPage() {
>                 return new MyPage(pageParameters);
>         });
>     }
> --
> View this message in context:
> http://www.nabble.com/WicketTester-and-Page-parameters---Wicket-Example-Unit-tests--tf4424879.html#a12638428
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: WicketTester and Page parameters & Wicket Example Unit tests?

Posted by cwilkes <cw...@ladro.com>.

wicket user wrote:
> 
> 1) I've got a page that gets hit by an outside credit card merchant once
> they have validated the card, they post me my transaction ID along with a
> whole host of other parameters. Getting them from the request is easy in
> the
> page itself but trying to unit test it is driving me nuts. Basically I
> want
> to start the page with parameters already loaded, it has to be staring me
> in
> the face but I haven't had any luck.
> 

Have you tried someething like this?

PageParameters pageParameters = new PageParameters();
pageParameters.add("userId", "1234");
wicketTester.startPage(new ITestPageSource() {
            public Page getTestPage() {
                return new MyPage(pageParameters);
        });
    }
-- 
View this message in context: http://www.nabble.com/WicketTester-and-Page-parameters---Wicket-Example-Unit-tests--tf4424879.html#a12638428
Sent from the Wicket - User mailing list archive at Nabble.com.


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


Re: WicketTester and Page parameters & Wicket Example Unit tests?

Posted by wicket user <wi...@comley.org>.
Hi Martijn,

Thanks for the response, I've had a look at the wickettester tests that are
available and they certainly are useful it was more along the lines of the
specific examples. I was just thinking that there would have been a lot less
questions from me if there were tests in the examples. If it's scheduled
thats cool and I would be happy to take on a few if help was needed but I
would probably have to have somebody look over my shoulder at first.........
we after all don't want the blind leading the blind (I hope that statement
isn't to unpolitically correct these days).

Now for number 1. ......

Many thanks
Simon

On 11/09/2007, Martijn Dashorst <ma...@gmail.com> wrote:
>
> I'll leave 1 for others.
>
> re: 2.
>
> The wicket examples sources are part of the wicket distribution. You
> can find them in src/jdk-1.5/wicket-examples
>
> There are tests available, but afaik they are jwebunit tests, and
> scheduled to be replaced with WicketTester due to the fact that
> jwebunit is now GPL and hence incompatible with Apache.
>
> Wicket itself does contain several wicket tester based tests. So you
> may want to take a look at that too.
>
> And you're not alone in your TDD. You may want to take a look at JDave
> (jdave.org), which is a nice project for test lovers. I also know that
> we have several folks that attain nearly 100% test coverage of their
> user interface (during a visit about 18 months ago to the KNAW they
> showed me).
>
> Martijn
>
> On 9/11/07, wicket user <wi...@comley.org> wrote:
> > Ok,
> >
> > Two questions really:
> >
> > 1) I've got a page that gets hit by an outside credit card merchant once
> > they have validated the card, they post me my transaction ID along with
> a
> > whole host of other parameters. Getting them from the request is easy in
> the
> > page itself but trying to unit test it is driving me nuts. Basically I
> want
> > to start the page with parameters already loaded, it has to be staring
> me in
> > the face but I haven't had any luck.
> >
> > 2) Are there unit tests for all the examples that are on
> > http://wicketstuff.org/wicket13/ ? If they are available it would be
> nice to
> > have the ability of viewing the tests alongside the htm and source, that
> way
> > you can see how to build and break it at the same time. Unless of course
> I'm
> > the only one doing a combination of FDD/TDD?
> >
> > Thanks again,
> > Simon
> >
> > ps. I have been snooping around hoping to actually contribute more then
> > questions but all the easy ones are answered already :-)
> >
>
>
> --
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0-beta3 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: WicketTester and Page parameters & Wicket Example Unit tests?

Posted by Martijn Dashorst <ma...@gmail.com>.
I'll leave 1 for others.

re: 2.

The wicket examples sources are part of the wicket distribution. You
can find them in src/jdk-1.5/wicket-examples

There are tests available, but afaik they are jwebunit tests, and
scheduled to be replaced with WicketTester due to the fact that
jwebunit is now GPL and hence incompatible with Apache.

Wicket itself does contain several wicket tester based tests. So you
may want to take a look at that too.

And you're not alone in your TDD. You may want to take a look at JDave
(jdave.org), which is a nice project for test lovers. I also know that
we have several folks that attain nearly 100% test coverage of their
user interface (during a visit about 18 months ago to the KNAW they
showed me).

Martijn

On 9/11/07, wicket user <wi...@comley.org> wrote:
> Ok,
>
> Two questions really:
>
> 1) I've got a page that gets hit by an outside credit card merchant once
> they have validated the card, they post me my transaction ID along with a
> whole host of other parameters. Getting them from the request is easy in the
> page itself but trying to unit test it is driving me nuts. Basically I want
> to start the page with parameters already loaded, it has to be staring me in
> the face but I haven't had any luck.
>
> 2) Are there unit tests for all the examples that are on
> http://wicketstuff.org/wicket13/ ? If they are available it would be nice to
> have the ability of viewing the tests alongside the htm and source, that way
> you can see how to build and break it at the same time. Unless of course I'm
> the only one doing a combination of FDD/TDD?
>
> Thanks again,
> Simon
>
> ps. I have been snooping around hoping to actually contribute more then
> questions but all the easy ones are answered already :-)
>


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

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