Newbie testing question

1 view
Skip to first unread message

Justine

unread,
Nov 25, 2007, 1:50:42 PM11/25/07
to Google Web Toolkit
I am using GWT with a library off sourceforge called googlemaps. This
jar contains java source that wraps javascript inside java classes to
access the Google Maps API. This allows me to remain as ignorant as
possible about javascript.

I include the googlemaps.jar in my classpath, and GWTCompile compiles
it fine. Everything works great so long as I run in the browser modes.

I would like to be able to test various aspects of my code using a
simple java driver with a main method instead of involving a browser.
But when I run my main method, I get a java.lang.UnsatisfiedLinkError
for one of the classes in the googlemaps jar. I assume this is because
java cannot find the compiled javascript that resulted from running
GWTCompile on the googlemaps.jar.

This is probably a really stupid question. But how do I get a java
command line to find the compiled javascript resulting from using the
GWT compiler?

Thanks,
Justine

Sumit Chandel

unread,
Nov 30, 2007, 7:04:50 PM11/30/07
to Google-We...@googlegroups.com
Hi Justine,

If what you're looking to do is test your GWT code, you are much better off using the GWTTestCase JUnit integration class rather than try to define main methods. In fact, it doesn't make much sense to test GWT code through main methods since what you're really interested in is testing how the code would run in a browser. GWT's hosted mode browser compiles your GWT code into byte code and runs this in the hosted mode browser environment, where it can correctly simulate how your GWT code would run on a regular browser as JavaScript. The GWTTestCase class allows you to run JUnit tests that run hosted mode in the background ( i.e., without popping up the hosted mode browser) so that the code you are testing would run as it would as generated JavaScript in a standard browser.

You can check out more on setting up GWTTestCases on your GWT code to test your application at the link below:

http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.JUnitIntegration.html

Hope that helps,
-Sumit Chandel
Reply all
Reply to author
Forward
0 new messages