java - 使用 GWT `tbroyer` maven 插件时运行 GWT JUnit 测试的正确方法是什么?
问题描述
为使用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
tbroyer
使用 GWT 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/main/module.gwt.xml
是。但是,这些文件之间没有任何区别,而您的问题实际上是您的测试类不在模块的源路径中:将其移动到client
子包以使其运行(并通过)。
推荐阅读
- c++ - 将 VariantDir 与 SCons Builder 一起使用时出现问题,该生成器生成文件列表以用作 Program 的源
- python - 如何使用 Python 的“imblearn”库将 (120, 100, 100) 形状的图像数据重塑为 (120, 10000) 形状以进行欠采样?
- javascript - datalist 如何打开和关闭
- angular - 如何解决 Angular 表单字段错误?
- c++ - Outputing 64bit integers in c++
- java - Maven:将一些依赖项复制到库目录中,并将其他依赖项合并到输出 JAR
- git - 从合并中删除未暂存的文件
- macos - 运行 brew update && brew upgrade 后,Iterm 窗口在启动时关闭(在 Mac 上使用 zsh)
- java - 检查服务器端广告查看 (php)
- sql - SQL DATETIME 到 Nodejs