google-code-export / gwt-test-utils

Automatically exported from code.google.com/p/gwt-test-utils
1 stars 0 forks source link

No declared GwtCreateHandler has been able to create an instance of 'com.example.mywebapp.client.GreetingService'. #112

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Extract GwtTestSample.zip (available from 
http://code.google.com/p/gwt-test-utils/downloads/list, dated Jan 14), and 
import to Eclipse.
2. Examine that the tests run successfully (I did Run As -> JUnit Test)
3. Edit war/WEB-INF/web.xml, change the line
<web-app>
to
<web-app xmlns="http://java.sun.com/xml/ns/javaee">
4. Run the unit tests again.

What is the expected output? What do you see instead?
I would expect that it does not screw up the tests. But it does: with all the 3 
tests will fail with the same Failure Trace:

com.octo.gwt.test.exceptions.GwtTestConfigurationException: No declared 
GwtCreateHandler has been able to create an instance of 
'com.example.mywebapp.client.GreetingService'. You should add our own with 
'GwtTest.addGwtCreateHandler(..)' method or declared your tested object with 
@Mock
    at com.octo.gwt.test.internal.patchers.GwtPatcher.create(GwtPatcher.java:37)
    at com.google.gwt.core.client.GWT.create(GWT.java)
    at com.example.mywebapp.client.GwtTestSample.<init>(GwtTestSample.java:35)
    at com.example.mywebapp.client.GwtTestSamleTest.beforeGwtTestSample(GwtTestSamleTest.java:70)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at com.octo.gwt.test.internal.runner.AbstractGwtRunner.run(AbstractGwtRunner.java:40)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

What version of the product are you using? On what operating system?
gwt-test-utils-0.35.zip from the Downloads page.
OS: Win XP 32 bit.
Java: 6 update 30.
Eclipse: 3.7 (Indigo) SR 1 with the latest updates.

Please provide any additional information below.

If you generate a new GWT project with webAppCreator (see 
http://code.google.com/webtoolkit/gettingstarted.html), it will generate a 
project with a web.xml starting like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee">

Actually this project is doomed to fail unit tests with the gwt-test-utils 
framework as given above by default. It took me quite some time to track down 
what causes the problem (replacing stuff in the webAppCreator generated project 
from your test project in small pieces, and testing continuously where it would 
start working).

Original issue reported on code.google.com by vangel.a...@gmail.com on 25 Jan 2012 at 8:09

GoogleCodeExporter commented 9 years ago
Eclipse is of type 'Eclipse IDE for Java Developers' if that matters (not the 
Java EE version).

Original comment by vangel.a...@gmail.com on 25 Jan 2012 at 8:14

GoogleCodeExporter commented 9 years ago

Original comment by gael.laz...@gmail.com on 26 Jan 2012 at 6:42

GoogleCodeExporter commented 9 years ago
When parsing XML with the DOM API, gwt-test-utils should ignore namespaces but 
wasn't. I've just deployed a new 0.36-SNAPSHOT with the fix.

Could you give it a try and validate it's working now ? Thanks !

Original comment by gael.laz...@gmail.com on 31 Jan 2012 at 6:32

GoogleCodeExporter commented 9 years ago
I'm terribly sorry to not replying earlier, I was way too busy.

I accidentally found the download link at:
http://code.google.com/p/gwt-test-utils/issues/detail?id=74

So I took the latest available jar file 
(gwt-test-utils-0.36-20120205.120430-11.jar) from 
http://forge.octo.com/nexus/content/repositories/snapshots/com/octo/gwt/test/gwt
-test-utils/0.36-SNAPSHOT/ and tested this problem, and now the tests run fine.

Thanks for fixing it quickly!

Original comment by vangel.a...@gmail.com on 11 Feb 2012 at 3:08

GoogleCodeExporter commented 9 years ago
Thx for your feeback !

Original comment by gael.laz...@gmail.com on 12 Feb 2012 at 7:01