Search the web
Sign In
New User? Sign Up
TestFirstUserInterfaces
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Test Driving GUIs that contain Tables   Message List  
Reply | Forward Message #994 of 1051 |
Greetings,

I'm interested to learn how folks approach TDDing views which contain
tables. I've read about using various styles of presenters (Supervising
Controller, Passive View, etc.) and was interested to hear what experiences
folks have had. I've just been reading Jeremy D. Miller's series on TDDing
GUIs
<http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your-own\
-cab-series-table-of-contents.aspx
>and
they were quite good.

In my particular case, I'm using the Google Web Toolkit (GWT) and need to
display a table of data. The interesting bits are:
- The table has a variable number of columns based on the data set being
displayed
- The table only shows certain columns (and variations of widgets) based
upon the user's permissions
- Each row contains widgets which may have different states (for example,
one cell might contain a combobox with a button, or might be a string with
no widgets)


So far I've started to try out a Passive View approach, where the controller
tells the view to add each cell individually. This is fairly verbose, and
one way requires the controller to tell the view the specific row and
column, e.g.

...
view.addLabelWithTextAt(5, 10, "Hello"); // row 5, column 10
view.addTitleSelectBoxAt(5, 11, listOfStringTitles, indexOfSelectedItem);
view.setReadOnlyList(5, 12, anotherListOfOptions);
...

This feels fairly chatty, and sometimes slightly awkward --- e.g. creating a
Select Box with a list of all valid options and the index/value selected in
one call. The advantage here is that it's very explicit in the view and I
could test this behavior.

Then, the view calls back to the controller with an index of the row that
received an event, so the controller can find the corresponding model in its
list. e.g. in the view

checkbox.addChangeListener() {
...
controller.titleChanged(11); // the Title Select Box widget is created
with a row # index
..
}



I know an alternative to Passive View would be a Supervising Controller,
where the View could take the set of model objects and explicitly map and
create all the columns needed. e.g. in the controller:

view.setPeopleList(people);

Since there are requirements that the table column length varies based upon
the data set, and some controls vary based upon permissions, this seems to
encode a lot of responsibility in the view... and that responsibility will
be trickier to test. (However, GWT does provide a test case which lets you
instantiate widgets in isolation, so perhaps this is another way to test.)


Can anyone comment on their experiences with this kind of work?

Thanks,

Dan


[Non-text portions of this message have been removed]




Sun Jul 29, 2007 12:59 am

etl_dan
Offline Offline
Send Email Send Email

Forward
Message #994 of 1051 |
Expand Messages Author Sort by Date

Greetings, I'm interested to learn how folks approach TDDing views which contain tables. I've read about using various styles of presenters (Supervising ...
Daniel Wellman
etl_dan
Offline Send Email
Jul 29, 2007
1:33 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help