GwtMockito GWT 应用测试工具开源项目

我要开发同款
匿名用户2015年04月15日
69阅读

技术信息

开源地址
https://github.com/google/gwtmockito
授权协议
Apache

作品详情

GwtMockito是GWT应用测试工具。

使用GWTTestCase测试GWT应用会比纯Java测试慢,而且不能使用基于反射的工具,比如模拟测试框架。如果尝试使用常规测试示例,那么会遇到这个错误:

ERROR: GWT.create() is oly usable i cliet code!  It caot be called,for example, from server code. If you are ruig a uit test, check that your test case exteds GWTTestCase ad that GWT.create() is ot calledfrom withi a iitializer or costructor.

GwtMockito就很好的解决了这个问题,允许从JUit测试中调用GWT.create。返回Mockitomocks。

使用:

public class MyWidget exteds Composite {  iterface MyUiBider exteds UiBider<Widget, MyWidget> {}  private fial MyUiBider uiBider = GWT.create(MyUiBider.class);  @UiField Label umberLabel;  private fial NumberFormatter formatter;  public MyWidget(NumberFormatter formatter) {    this.formatter = formatter;    iitWidget(uiBider.createAdBidUi(this);  }  void setNumber(it umber) {    umberLabel.setText(formatter.format(umber));  }}

功能介绍

GwtMockito 是 GWT 应用测试工具。 使用 GWTTestCase 测试 GWT 应用会比纯 Java 测试慢,而且不能使用基于反射的工具,比如模拟测试框架。如果尝试使用常规测试示例...

声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论