How to enable Java log files and diagnose issues

Last edited on

Check the Runner/Server Log

Check the Runner/Server Log; most errors can be detected by looking at the java command.

Only Standard GUIs are Supported

Is the application using AWT/Swing or SWT? Squish does not support any other Java GUI toolkits or non-GUI applications.

Capture Pre-Hooking Errors for Diagnosis

Wrap the java command in a batch file on windows to redirect any pre-hooking errors to help diagnose the problem. Such a file might contain a line like this which will execute the com.myCompany.Main application and redirect all standard and error output to the file my.log:

java com.myCompany.Main  > c:\my.log 2>&1

Don&rsquo;t use <code>-server</code> or <code>-client</code> arguments

The java or java.exe's -server and -client command line arguments can cause hooking failures, so do not use them. If Java is executed from a batch file or shell script remove the -server and -client arguments if present.

Tell Squish to use the Server JVM

If you want to force the use of the server JVM, this can be done without using the troublesome -server command line option. It can be done by editing Squish’s server.ini file (%appdata%\froglogic\Squish\ver1\server.ini on Windows or ~/.squish/ver1/server.ini on Unix). Change the file’s LibJVM entry to use the server JVM. For example, if the LibJVM entry is:

LibJVM = "c:\Program Files (x86)\Java\jdk1.6.0_11/jre\bin\client\jvm.dll"

Change it to:

LibJVM = "c:\Program Files (x86)\Java\jdk1.6.0_11/jre\bin\server\jvm.dll"

Naturally, you must use the actual paths that are correct for your machine.

Set <code>SQUISH_DISABLE_AWT</code> Correctly for SWT/RCP Applications

Set the environment variable SQUISH_DISABLE_AWT to 1 before starting Squish for testing SWT/RCP applications. For example:

set SQUISH_DISABLE_AWT=1

Try Using the Fallback Hooking Method

Squish 4 introduced a new hooking method that provides better performance and reliability in most cases than the Squish 3 method. However, in rare cases it might be necessary to use the old method. This can be done by configuring the squishserver as follows:

C:\> SQUISHDIR\bin\squishserver --config setJavaHookMethod cmdline

Get Additional Logging Information

Create the directory structure /tmp/frogtemp/log on Unix-like systems or C:\tmp\frogtemp\log on Windows. (Note that on Windows this structure must be on the same drive as the test case’s working directory, so change C: to D: or whatever drive you are actually using if necessary.)

With this structure in place, Squish will locate the directory and save logging data into it. However, if you test different Java applications, they will overwrite each other’s log files, so you should just test the problematic application (or copy the log between test runs).

Use DebugView for More Information

Download DebugView from Microsoft.

Start Squish and before trying to record a new test do two things. First, click Window→Preferences and in the Preferences dialog navigate to the Squish item’s Logging item and make sure that logging is enabled (especially for Hooking). Second, start the DbgView.exe application.