Testing using GWTTestCase (GWT 1.4) in GWTShell noserver mode

59 views
Skip to first unread message

Lodewijk

unread,
Aug 30, 2007, 11:27:31 AM8/30/07
to Google Web Toolkit
Hi,

I am building a framework for a web application that uses services
from an existing J2EE application.
Important goals for the framework are: testability, encapsulation, non-
intrusiveness of used technologies, open for refactorings, one-time
configuration (no repeated configuration).

I am using Spring to inject some dependencies into the GWT rpc service
implementation, one of the reasons I need a customized web.xml. I
don't want to duplicate this web.xml in the GWT module description
file, I want to configure once, I don't want to have to keep several
configuration files in synch with each other.

Ok, for this reason I use GWTShell in the noserver mode, to run GWT
client code in hosted browser mode.
Problem is now that I also have some unit tests for my GWT client
modules. The unit tests derive from GWTTestCase. However GWTTestCase
starts up GWTShell using it's own web container (tomcat) and it's own
web.xml.

That is undesirable, I need GWTShell to connect with my own J2EE
container. How can I accomplish that?

A workaround is to use mock GWT RPC service implementations, map those
in the test GWT module description file and run the test. That works,
but doesn't suffice. That way I can test that the asynch calling
mechanism works, but I cannot test the whole chain: that my actual GWT
RPC service implementations also work the call from the GWT client
module.

Other question: Has anyone experience with the GWT facet in IntelliJ.
I also have problems with configuring this GWT facet in IntelliJ. The
problem is that I can only define one GWT facet for each IntelliJ
module, and that I can only choose one IntelliJ web facet as target
for the GWT facet. This means that the GWT test modules are also
compiled together with the productive client code by one and the same
GWT facet and end up in the productive web facet. I end up with a war
containing GWT test code.
The workaround is to define a seperate IntelliJ module containing the
tests. That works fine, but has the disadvantage of increased
conceptual distance between the actual GWT client and the test code,
they are distributed over two seperate IntelliJ modules.

If anyone has some thoughts about this, please let me know,

thx,

Lodewijk

Reply all
Reply to author
Forward
0 new messages