On Wednesday, June 13, 2012 11:48:22 PM UTC+2, Mike Dee wrote:
>
> I got this HyperlinkCell class somewhere and it works pretty good.
>
> public class HyperlinkCell extends AbstractCell<Hyperlink>
> {
> @Override
> public void render( com.google.gwt.cell.client.Cell.Context context,
> Hyperlink h, SafeHtmlBuilder sb )
> {
> sb.append( SafeHtmlUtils.fromTrustedString( h.toString() ) );
> }
> }
>
That's basically equivalent to this lighter-weight version (does not
construct a DOM object for the Hyperlink widget):
public class LinkCell extends AbstractCell<TokenAndLabel> {
interface Templates extends SafeHtmlTemplates {
@Template("<a href='{0}'>{1}</a>")
SafeHtml link(SafeUri token, String label);
}
private static final Templates TEMPLATE = GWT.create(Templates.class);
@Override
public voif render(Cell.Context context, TokenAndLabel value,
SafeHtmlBuilder sb) {
sb.append(TEMPLATE.template(UriUtils.fromString("#" +
value.getToken()), value.getLabel()));
}
}
> As I thought about it more I ask myself what do I want to test. I'd like
> to test that the data in the view is retrieved properly, put into a query
> properly, and that the query works. I don't need to test that the view
> displays things properly. I'll assume Google tested its widgets.
>
> Given that, what do you think about this idea for testing? I got this
> idea by examining the Display interface technique.
>
> Add getters and setters to for each view field. Using the above example,
>
> public class PersonSearchViewImpl extends ResizeComposite implements
> PersonSearchView
> {
> public void setFirstname( String firstname )
> {
> this.firstname.setText( firstname );
> }
>
> public String getFirstname()
> {
> firstname.getText();
> }
> }
>
Have a look at
http://www.google.com/events/io/2010/sessions/gwt-continuous-build-testing.html
The Wave guys came up with a model where the presenter controls the view,
so there's no getter; the view calls the presenter back with the values
when needed (i.e. your find() method would have the firstname et al. as
arguments).
Then a GWTTestCase could be written to call all the setters (which fill in
> the form fields) and press the Find button (need to add a method to
> simulate the pressing of the Find button).
>
If you assume Google tested the widgets, why are you using a GWTTestCase?
Mock the view and use a standard JUnit test case, it'll run so much faster!
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/AjuxOwaXUboJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.