I've created a sample project to run my gwt tests with gwt-test-utils (https://github.com/povilasb/gwt-test-utils-sample). I'm using Ant (1.8.2) for builds, packages: gwt 2.6, juni 4.11 and gwt-test-utils 0.47.
Unfortunately I fail to run tests:
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
It seems like someone already had this issue before: https://code.google.com/p/gwt-test-utils/issues/detail?id=168. Couldn't find the solution there.
Anyone had luck with gwt 2.6 and gwt-test-utils 4.7 and ant?
I managed to solve my issue. I eliminated the error
By using fork mode in
Ant
junit
task:This is the recommended method to run
junit
tests:After this I had another error:
And I solved this error by adding source code directory to
junit
classpath:I guess gwt-test-utils needed sources of the gwt module. You can find fully working sample project on github.