Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7678165
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:34:58+00:00 2026-05-31T17:34:58+00:00

Case i’m trying to write a GWTTestCase for a certain class, used as a

  • 0

Case

i’m trying to write a GWTTestCase for a certain class, used as a presenter for a history-browsing toolbar component i’m building.

Problem

one (or more) of the scripts apparently not being loaded for the jUnit testing environment. it all works fine when running the application (development mode), but when i try to run the test case, the application (web server as well as user agent) fails to load, and the following exception arouses (stacktrace is shortened for simplicity):

com.gargoylesoftware.htmlunit.ScriptException: Wrapped com.gargoylesoftware.htmlunit.ScriptException: Exception invoking jsxFunction_write  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601)   at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)    at net.sourceforge.htmlunit.corejs.javascript.ContextFactory.call(ContextFactory.java:538)  at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine.execute(JavaScriptEngine.java:499)     at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)   ... 41 more

...

Caused by: com.gargoylesoftware.htmlunit.ScriptException: Wrapped com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: "Raphael" is not defined. (http://192.168.10.32:3692/com.gigaspaces.admin.webui.Gs_webui.JUnit/dracula/dracula_graffle.js#18) (http://192.168.10.32:3692/com.gigaspaces.admin.webui.Gs_webui.JUnit/com.gigaspaces.admin.webui.Gs_webui.JUnit.nocache.js#16)    at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:601)

Relevant sources

here is the (ridiculously simple) GWTTestCase used:

public class HistoryBrowserTest extends GWTTestCase {

    @Override
    public String getModuleName() {
        return "com.gigaspaces.admin.webui.Gs_webui";
    }

    public void testHistoryBrowser() {
        assertTrue(true);
    }
}

Dependencies / context information

jUnit 4.10 is used as an external jar – and referenced successfully by the classpath and the .gwt.xml file is inheriting jUnit from GWT (<inherits name="com.google.gwt.junit.JUnit" />) the jUnit module is no longer inherited as the GWT team instructs not to – extending GWTTestCase will inherit it automatically.

i am using Raphael-GWT as a separate module. this module is also referenced in the main module’s .gwt.xml file, and running fine under all other circumstances (development / production mode).

What have i tried

  • simplifying the case, e.g. stripping down the test case as seen above.
  • verifying inherited modules in the deployment descriptors.
  • varying jUnit’s version, i.e. running both under V3 or V4, and manually compiled on each change.
  • looked up on google, as well as here on stackoverflow, with no avail.

More relevant information

Raphael lib is being used for a GWT wrapper i wrote for Dracula (a JS graph visualization library) so dracula_graffle.js originates there. enclosed is the .gwt.xml file source for a reference:

<module rename-to="gs_webui">

    <inherits name="com.google.gwt.user.User" />

    <!-- Other module inherits -->
    <inherits name="com.extjs.gxt.ui.GXT" />
    <inherits name="org.highchartsgwt.HighCharts" />
    <inherits name="gwtupload.GWTUpload" />
    <inherits name="com.hydro4ge.raphaelgwt.RaphaelGWT" />
    <inherits name="com.gigaspaces.gauge.Gs_gauges" />
    <inherits name="com.gigaspaces.graphs.Gs_graphs" />
    <inherits name="com.gigaspaces.svgcomponents.Gs_svg_components" />
    <inherits name="com.javaconstructors.colorpalette.Color_palette" />
    <inherits name="com.gigaspaces.jquerywidgets.Gs_jquery_widgets" />
    <inherits name="com.gigaspaces.codemirror_gwt.CodeMirror_GWT"/>

    <inherits name="com.google.gwt.i18n.I18N"/>
    <inherits name="com.google.gwt.query.Query" />

    <!-- I18N stuff, log configurations, and so forth... -->

    <entry-point class="com.gigaspaces.admin.webui.client.Gs_webui" />

    <!-- further source folder inherits... -->

</module>                                                                              
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:34:59+00:00Added an answer on May 31, 2026 at 5:34 pm

    How is Raphael loaded? It could be that the js file is never being pulled in to the html page being run in htmlunit.

    Caused by: com.gargoylesoftware.htmlunit.ScriptException: Wrapped com.gargoylesoftware.htmlunit.ScriptException: ReferenceError: “Raphael” is not defined. (http://192.168.10.32:3692/com.gigaspaces.admin.webui.Gs_webui.JUnit/dracula/dracula_graffle.js#18) (http://192.168.10.32:3692/com.gigaspaces.admin.webui.Gs_webui.JUnit/com.gigaspaces.admin.webui.Gs_webui.JUnit.nocache.js#16)

    This file doesn’t appear to be used by RaphaelGWT, as it is not listed in their module file (seen here http://code.google.com/p/raphaelgwt/source/browse/trunk/src/com/hydro4ge/raphaelgwt/RaphaelGWT.gwt.xml).

    This seems to be the source of your error – dracula_graffle.js (either line 18, or this is the 18th file loaded) cannot find the symbol Raphael, and since it is somehow required by your module, the app (in this case test) can’t load without it. My quick guess is that it is either an HtmlUnit issue (HtmlUnit is what the gwt test cases run in, and only simulates a real browser) – you might try running this same test in a real browser, see http://code.google.com/webtoolkit/doc/latest/DevGuideTesting.html#Manual_Mode for more info. If that fails, then perhaps your app normally loads into an html page where some JS files have already been loaded, so this doesnt happen – those need to be loaded when testing the app as well, either using ScriptInjector in a setup method, or by adding them to your module file.


    (After edits, comments)

    Since the error occurred in manual mode as well, there isn’t an error with htmlunit, but with dependencies in your code. From what appears to be a copy of dracula_graffle.js at http://code.google.com/p/synoptic/source/browse/synopticgwt/war/dracula_graffle.js?spec=svn2164f4b075bb0ed77f7b008bd113e04831196fec&r=2164f4b075bb0ed77f7b008bd113e04831196fec, line 18 is the first reference to Raphael, which should have defined when the raphael js file was loaded, which implies that it wasn’t.

    Running in manual mode with Firebug or the like running should show you an error in the console. Based on this, I think it is safe to say that something is different about the test case than the standard entrypoint+html page. The question is, what is different.

    Are there any JS files, or script tags that run when the html page loads? GWTTestCases always run with just a very simple html page, and only load scripts defined in the module that you actually name in your .gwt.xml file. Are there any setup functions that are run as part of the entrypoint? Have you tried making a new, very simple html page, and writing a new, very simple EntryPoint for the module and using that instead? In the course of testing these things, I believe you will find some difference that is important in how your app works from how your test works.

    If there isn’t… the next annoying step is to run in manual mode again, with your app compiled in production model (see the same link, it should give details on how that might be done). Set firebug (or whatever tool you prefer) to stop on exceptions in Js, or simple set a breakpoint on line 18, when Raphael is used for the first time in dracula_graffle.js to see what scripts have loaded, and why Raphael isn’t yet defined.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Case One Say you have a little class: class Point3D { private: float x,y,z;
Use case: Fitnesse is used for automated testing of the web site. SUT (software
Given: case class FirstCC { def name: String = ... // something that will
case class Test(kind: Int) { val ifX = if (isX) is X else not
Case : Again trying to capture packets through my NIC, I have developed 2
Use case: Wanna insert custom annotation to fields in java class generated by JAXB
Case 1 in question: I have been trying to have a pure 64-bit development
Case 1 I have 2 synchronized methods as shown below: class A { public
class Case( models.Model ): created = models.DateTimeField() modified = models.DateTimeField() STATUS = ( ('Active',
In case of this class public class Foo {public Int32 MyField; } What will

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.