Wednesday, November 3, 2010

Re: Testing complex Widgets without interface ?

On 3 nov, 22:39, Ed <post2edb...@gmail.com> wrote:
> I like to know how others test their logica in complex widgets.
>
> Example: I have a Form and FormField widget and the both extend from
> Composite.
> They contain logic that I would love to test in a unit test which is
> hard.
>
> Of course I could split this up in a MVP pattern, but that isn't very
> elegant on widget level and too cumbersome in this case.
>
> So this makes testing very hard... and it can only be done through the
> slow GWTTestCase JUnit mechanism.
> If I would have a Widget interface, I could easily mock the Form and
> FormField with a test implementation containing the logic that I want
> to test.
>
> I am now considering these widgets to NOT extends from Composite
> anymore such that I can create them in a not-gwt environment and test
> them properly.
> I then let Form and FormField implement HasAWidget interface that
> contains a method Widget asWidget(), in case you want the associated
> widget from Form and FormField..
> It's an OK solution, but still a workaround because we don't have a
> Widget interface.
>
> I am suprised that not many people talk about this problem in the
> community so maybe I am just missing something :(
> I noticed this issue: 5275, that is similar:
> http://code.google.com/p/google-web-toolkit/issues/detail?id=5275
>
> How do you do this?

See my answer in the issue tracker; in brief, move from a "Passive
View" pattern to a "Supervising Controller" pattern and you'll no
longer see "widgets" in your presenter.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate