2014-05-12 4 views
0

gwt-test-utils (https://github.com/povilasb/gwt-test-utils-sample)로 gwt 테스트를 실행하기위한 샘플 프로젝트를 만들었습니다. 빌드, 패키지 : gwt 2.6, juni 4.11 및 gwt-test-utils 0.47에 Ant (1.8.2)를 사용하고 있습니다.gwt-test-utils가 Ant를 사용하여 테스트를 실행하지 못했습니다.

불행하게도 나는 테스트를 실행하는 데 실패 : https://code.google.com/p/gwt-test-utils/issues/detail?id=168 : 그것은 사람처럼 보인다

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 

이미 전에이 문제를 가지고 있었다. 해결책을 찾을 수 없습니다.

누구나 gwt 2.6 및 gwt-test-utils 4.7 및 개미와 함께 운이 좋았습니까?

답변

1

나는 내 문제를 해결할 수있었습니다. 내가 다른 오류 한이 후

In general, forking a new VM is recommended since it isolates your test from Ant's environment (which contains a lot of libraries on the classloader, in particular XML related classes) but it becomes really slow because of the big overhead associated with starting new Java VMs.

:

<junit haltonfailure="false" includeantruntime="false" 
    fork="yes" forkmode="once" > 

junit 테스트를 실행하는 recommended method이다 : 나는 Antjunit 작업에서 포크 모드를 사용하여 오류

Error while scanning package 'com.googlecode.gwt.test.internal.patchers'

을 제거 :

test: 
    [junit] WARNING: multiple versions of ant detected in path for junit 
    [junit]   jar:file:/usr/share/ant/lib/ant.jar!/org/apache/tools/ant/Project.class 
    [junit]  and jar:file:/home/povilas/projects/gwt-test-utils-sample/lib/ant-1.8.2.jar!/org/apache/tools/ant/Project.class 
    [junit] Testsuite: com.example.gwtTestUtils.client.PersonTest 
    [junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.005 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] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
    [junit] ------------- ---------------- --------------- 
    [junit] Testcase: initializationError(com.example.gwtTestUtils.client.PersonTest): Caused an ERROR 
    [junit] Error while generating gwt-test-utils prerequisites 
    [junit] com.googlecode.gwt.test.exceptions.GwtTestException: Error while generating gwt-test-utils prerequisites 
    [junit]  at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:119) 
    [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.google.gwt.core.ext.UnableToCompleteException: (see previous log entries) 
    [junit]  at com.google.gwt.dev.cfg.ModuleDefLoader.nestedLoad(ModuleDefLoader.java:315) 
    [junit]  at com.google.gwt.dev.cfg.ModuleDefLoader$1.load(ModuleDefLoader.java:100) 
    [junit]  at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:197) 
    [junit]  at com.google.gwt.dev.cfg.ModuleDefLoader.doLoadModule(ModuleDefLoader.java:176) 
    [junit]  at com.google.gwt.dev.cfg.ModuleDefLoader.createSyntheticModule(ModuleDefLoader.java:105) 
    [junit]  at com.googlecode.gwt.test.internal.GwtFactory.createModuleDef(GwtFactory.java:164) 
    [junit]  at com.googlecode.gwt.test.internal.GwtFactory.<init>(GwtFactory.java:110) 
    [junit] 
    [junit] 
    [junit] Test com.example.gwtTestUtils.client.PersonTest FAILED 

BUILD SUCCESSFUL 
Total time: 1 second 
01 23,516,

그리고 junit 클래스 경로에 소스 코드 디렉토리를 추가하여이 오류를 해결 :

<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 모듈의 소스를 필요로 GWT-테스트 유틸을 것 같아요. github에서 완벽하게 작동하는 샘플 프로젝트를 찾을 수 있습니다.

관련 문제