GWT,Open/view 只是 window class 测试

GWT, Open/view just window class on tests

我是 GWT 的新手,我想知道是否有一种方法可以在 GWT 中测试和扩展 Window class 的对象。 是否可以用同样的方式在 chrome 中打开这个 window。我很想在 junit 上测试这个。只是为了部署我 window 这样我就可以在部署整个项目之前对其进行测试。

public class WinAhorroPrg extends Window

这会节省我很多时间。

像这样调用它测试

@Test
public void testWindowWinAhorroProg{
/*some other classes/code*/
winAhorroPrg.show();
}

然后打开它 http://localhost:8888/testWindow

顺便说一句,我使用的是一个非常旧的 gwt (2.1.1) 版本,不允许我更新。

在 GWT 中,Window class 提供对 浏览器 window 的方法、属性和事件的访问。 运行 在 Junit 中您将没有浏览器。还有一个浏览器模拟,也称为 HtmlUnit, that maybe will help you to think in a way to implement your tests. Have a look at the GWT Testing Guide