gwt测试utils无法使用Ant运行测试

gwt测试utils无法使用Ant运行测试,gwt,gwt2,gwt-test-utils,Gwt,Gwt2,Gwt Test Utils,我已经创建了一个示例项目,用gwt test UTIL()运行我的gwt测试。我将Ant(1.8.2)用于构建和包:GWT2.6、JUnit4.11和GWTTestUTILS0.47 不幸的是,我无法运行测试: html-test-utils-config: test: [junit] Testsuite: com.example.gwtTestUtils.client.PersonTest [junit] Tests run: 1, Failures: 0, E

我已经创建了一个示例项目,用gwt test UTIL()运行我的gwt测试。我将Ant(1.8.2)用于构建和包:GWT2.6、JUnit4.11和GWTTestUTILS0.47

不幸的是,我无法运行测试:

html-test-utils-config:

test:


     [junit] Testsuite: com.example.gwtTestUtils.client.PersonTest
        [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.006 sec
        [junit] 
        [junit] ------------- Standard Error -----------------
        [junit] SLF4J: Failed to load class org.slf4j.impl.StaticLoggerBinder.
        [junit] SLF4J: Defaulting to no-operation (NOP) logger implementation
        [junit] ------------- ---------------- ---------------
        [junit] Testcase: initializationError(com.example.gwtTestUtils.client.PersonTest):  Caused an ERROR
        [junit] Error while scanning package 'com.googlecode.gwt.test.internal.patchers'
        [junit] com.googlecode.gwt.test.exceptions.GwtTestPatchException: Error while scanning package 'com.googlecode.gwt.test.internal.patchers'
        [junit]     at com.googlecode.gwt.test.internal.ClassesScanner.scanPackages(ClassesScanner.java:68)
        [junit]     at com.googlecode.gwt.test.internal.ConfigurationLoader.visitPatchClasses(ConfigurationLoader.java:291)
        [junit]     at com.googlecode.gwt.test.internal.ConfigurationLoader.<init>(ConfigurationLoader.java:65)
        [junit]     at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:91)
        [junit]     at com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:46)
        [junit]     at com.googlecode.gwt.test.internal.junit.AbstractGwtRunner.<init>(AbstractGwtRunner.java:30)
        [junit]     at com.googlecode.gwt.test.GwtRunner.<init>(GwtRunner.java:19)
        [junit]     at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        [junit]     at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
        [junit] Caused by: com.googlecode.gwt.test.exceptions.GwtTestPatchException: Cannot find class in the classpath : 'com.googlecode.gwt.test.internal.patchers.AbstractHasDataPatcher'
        [junit]     at com.googlecode.gwt.test.internal.GwtClassPool.getClass(GwtClassPool.java:27)
        [junit]     at com.googlecode.gwt.test.internal.ClassesScanner.visitClass(ClassesScanner.java:107)
        [junit]     at com.googlecode.gwt.test.internal.ClassesScanner.scanClassesFromJarFile(ClassesScanner.java:99)
        [junit]     at com.googlecode.gwt.test.internal.ClassesScanner.scanPackages(ClassesScanner.java:62)
        [junit] 
        [junit] 
        [junit] Test com.example.gwtTestUtils.client.PersonTest FAILED

BUILD SUCCESSFUL           
Total time: 1 second 
html测试utils配置:
测试:
[junit]测试套件:com.example.gwtestutils.client.PersonTest
[junit]测试运行:1,失败:0,错误:1,运行时间:0.006秒
[少年]
[junit]------标准错误-----------------
[junit]SLF4J:未能加载类org.SLF4J.impl.StaticLoggerBinder。
[junit]SLF4J:默认为无操作(NOP)记录器实现
[junit]--------------------------------
[junit]Testcase:initializationError(com.example.gwtestutils.client.PersonTest):导致错误
扫描包'com.googlecode.gwt.test.internal.patchers'时[junit]出错
[junit]com.googlecode.gwt.test.exceptions.gwtsetpatcheption:扫描包'com.googlecode.gwt.test.internal.patchers'时出错
[junit]位于com.googlecode.gwt.test.internal.ClassesScanner.scanPackages(ClassesScanner.java:68)
[junit]位于com.googlecode.gwt.test.internal.ConfigurationLoader.visitpatchlasses(ConfigurationLoader.java:291)
[junit]位于com.googlecode.gwt.test.internal.ConfigurationLoader.(ConfigurationLoader.java:65)
[junit]位于com.googlecode.gwt.test.internal.GwtFactory.(GwtFactory.java:91)
[junit]位于com.googlecode.gwt.test.internal.GwtFactory.initializeIfNeeded(GwtFactory.java:46)
[junit]位于com.googlecode.gwt.test.internal.junit.AbstractGwtRunner。(AbstractGwtRunner.java:30)
[junit]位于com.googlecode.gwt.test.GwtRunner.(GwtRunner.java:19)
[junit]位于java.lang.reflect.Constructor.newInstance(Constructor.java:532)
[junit]位于java.lang.reflect.Constructor.newInstance(Constructor.java:532)
[junit]原因:com.googlecode.gwt.test.exceptions.gwtsetPatcheption:在类路径中找不到类:“com.googlecode.gwt.test.internal.patchers.AbstractHasDataPatcher”
[junit]位于com.googlecode.gwt.test.internal.GwtClassPool.getClass(GwtClassPool.java:27)
[junit]位于com.googlecode.gwt.test.internal.ClassesScanner.visitClass(ClassesScanner.java:107)
[junit]位于com.googlecode.gwt.test.internal.ClasseScanner.scanClassesFromJarFile(classeScanner.java:99)
[junit]位于com.googlecode.gwt.test.internal.ClassesScanner.scanPackages(ClassesScanner.java:62)
[少年]
[少年]
[junit]测试com.example.gwtestutils.client.PersonTest失败
建设成功
总时间:1秒
似乎有人以前就有过此问题:。在那里找不到解决方案


有人在gwt 2.6和gwt测试utils 4.7以及ant方面很幸运吗?

我设法解决了我的问题。我消除了错误

扫描包“com.googlecode.gwt.test.internal.patchers”时出错

Ant
junit
任务中使用fork模式:

<junit haltonfailure="false" includeantruntime="false"
    fork="yes" forkmode="once" >
我通过将源代码目录添加到
junit
classpath解决了这个错误:

<property name="src.dir" value="src" />
...
<junit haltonfailure="false" includeantruntime="false"
    fork="yes" forkmode="once" >
    ...
    <classpath>
        <path refid="project.class.path" />
        <pathelement location="${test.build.dir}" />
        <pathelement location="${src.dir}" />
    </classpath>

    ...
</junit>

...
...
...
我想gwt测试UTIL需要gwt模块的源代码。您可以在上找到完全工作的示例项目

<property name="src.dir" value="src" />
...
<junit haltonfailure="false" includeantruntime="false"
    fork="yes" forkmode="once" >
    ...
    <classpath>
        <path refid="project.class.path" />
        <pathelement location="${test.build.dir}" />
        <pathelement location="${src.dir}" />
    </classpath>

    ...
</junit>