Running JUnit tests on remote systems
This document explains how to run GWT tests on remote systems.
There are three types of remote RunStyles that can help you run remote tests:
To use any of these run styles, you need to pass the
-runStyle argument to the test infrastructure (see Passing Arguments to the Test Infrastructure). The format looks like this (see specific examples below):
If you are running a test from Eclipse, you would add something like the following to the VM arguments (Note that the run style name starts with a capital letter):
The following arguments are useful when running remote tests.
If you are not familiar with development mode versus production mode, you should read the associated tutorials on Compiling and Debugging first. All of the following examples assume that you are running tests in development mode, which requires that you have the GWT Developer Plugin installed. Its important to note that URLs must be whitelisted before this plugin will connect to them. This means that you must allow the remote connection on the remote system the first time you run the test, or ahead of time if possible.
Tests run in development mode by default. You can run a test in production mode by adding
-prod to the GWT arguments. When running tests in production mode, you do not need to have the GWT Developer Plugin installed on the remote system.
-Dgwt.args="<strong>-prod</strong> -runStyle Selenium:myhost:4444/*firefox"
When running tests in production mode, GWT compiles the tests for all browsers, which can take a while. If you know which browsers your test will run in, you can limit the browser permutations (and reduce compile time), using the
-Dgwt.args="-prod <strong>-userAgents ie6,gecko1_8</strong> -runStyle Selenium:myhost:4444/*firefox"
The Manual run style allows you to run JUnit tests in any browser by directing the browser to a URL that GWT provides. For details, see Running tests in manual mode. In particular, manual mode can be used for remote testing — the browser may be running on a computer different from the one where the tests were started.
Recommended for Firefox, Safari, Google Chrome, and Internet Explorer (see note).
Internet Explorer: You can try running Internet Explorer in Selenium as it is a supported browser. If the tests work for you, then you don't need to use the RemoteWeb runstyle at all, which should simplify your testing. However, we've found that Selenium does not always open Internet Explorer successfully on newer versions of Windows. If this happens, you can try passing the
-singleWindow argument into Selenium.
GWT can execute tests against a remote system running the Selenium Remote Control. You do this using the following command:
In the above example, we are using the Selenium run style to execute a development mode test on Firefox against two remote systems (myhost and myotherhost).
Note: On newer versions of Windows, if you run Selenium as an Administrator, you will not run tests in development mode because the GWT Developer Plugin is installed for the current user only.
By default, Selenium creates a new Firefox profile so it can prevent unnecessary popups that would otherwise mess up the test. However, you will probably want to create your own Firefox profile that includes the GWT Developer Plugin.
To do this, run Firefox from the command line and pass in the -ProfileManager argument to open the Profile Manager:
Create a new profile (remember the location), and open it. Setup the profile however you want, making sure to install the GWT Developer Plugin. On our test systems, we use the following settings:
When starting the selenium server, pass in the following argument to use your firefox profile as a template:
Deprecated. Will be removed in GWT 2.7.
The RemoteWeb run style allows you to run tests against systems running the BrowserManagerServer, a server that GWT provides.
First, you need to start the BrowserManagerServer on the remote test system using the following java command. Note that gwt-user.jar and gwt-dev.jar are on the classpath.
java -cp gwt-user.jar;gwt-dev.jar com.google.gwt.junit.remote.BrowserManagerServer ie8 "C:\Program Files\Internet Explorer\IEXPLORE.EXE"
BrowserManagerServer takes commands in pairs. In the above example, we are associating the name “ie8” with the executable iexplore.exe.
<browser name> <path/to/browser>
To run a test against IE8, you would use the following argument: