繁体   English   中英

使用GWT`tbroyer` maven插件时,运行GWT JUnit测试的正确方法是什么?

[英]What is the correct way to run GWT JUnit test when using GWT `tbroyer` maven plugin?

对使用tbroyer maven插件的GWT项目运行JUnit测试的正确方法是什么?

我创建了一个示例应用程序来展示引发失败的测试

Loading inherited module 'com.todogwt.App'
   [ERROR] Unable to find 'com/todogwt/App.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?

这是代码: https : //github.com/incube8r/todogwt

测试非常简单

public class TestHelloWorld extends GWTTestCase {

    @Override
    public String getModuleName() {
        return "com.todogwt.App";
    }

    public void test() {
        Window.alert("Hello world!");
        Console.log("Hello world!");
        delayTestFinish(1000);
        finishTest();
    }

}

使用位于下面的测试module.gwt.xml

src/test/module.gwt.xml

使用GWT tbroyer maven插件时,运行JUnit测试的正确方法是什么?

gwt:test默认情况下希望您使用测试套件: https : //tbroyer.github.io/gwt-maven-plugin/test-mojo.html#includes ; 您可以使用-Dtest=TestHelloWorld来运行,但是必须更新到gwt-maven-plugin的最新版本(目前为1.0-rc-10); 或者您可以重新定义<includes>以匹配您的测试。

最后但并非最src/test/module.gwt.xml一点是, src/test/module.gwt.xml没有被任何东西使用。 只有src/main/module.gwt.xml是。 但是,这些文件之间没有任何区别,实际上,您的问题是测试类不在模块的源路径中:将其移动到client端子包以使其运行(并通过)。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM