The Squish for Java edition not only supports testing Java Swing/AWT, SWT/Eclipse RCP or JavaFX based applications but also Java Web Start applications. There are two ways to automate an application started via Java Web Start:
1. Start via web browser
2. Start via the tool javaws
1. Start via web browser:
When a Web Start application is started via a web browser, Squish for Web should be used to automate the web browser to perform the steps that start the Web Start application.
In this case the Web Start application gets hooked automatically by Squish and every user interaction with it is recorded.
A new application context is introduced for the Web Start application. You can use this application context to switch between the current applications.
2. Start via the tool javaws:
When using javaws to start the Web Start application, you can configure the tool javaws (which is included in the JRE (Java Runtime Environment) installations) as AUT and pass the URL to your Web Start application to it.
This can be done in the Squish IDE’s test suite settings.
A few things need to be taken care of to be able to automate a Web Start application successfully:
Setting Maximum Startup Time:
One should make sure that Squish waits long enough for the application to get started. This is done by setting a suitable Maximum Startup Time in the Squish IDE at Edit > Server Settings > Application Behavior. Change the Maximum Startup Time setting to the time your application normally needs plus, say, an extra 30 seconds to allow for temporary extra demand on the machine.
So, for a normal 60 second startup, set the time to 90 seconds.
Setting a Maximum Post-Mortem Wait Time:
The Maximum Post-Mortem Wait Time is the time Squish should wait after the first AUT process has exited. Sometimes the launcher process may exit before the second (the « real ») AUT process has been hooked up by Squish.
This value should be set to twice the time (in milliseconds) between the appearance of the Java Web Start splash screen and the appearance of the application.
For example if that time is 5 seconds, then this value should be set to 10000:
Making sure that the right JRE is being used :
- Web Start decides which JRE (Java Runtime Environment) gets used for executing the AUT (Application Under Test). (This applies only if multiple JREs are installed of course.)
- The only known way to force a particular JRE version to be used by Web Start (settings in the JNLP file not considered) is to disable the unwanted JREs in the Java Control Panel.
- Squish must be configured for the same JRE as used for executing the AUT. (To find which JRE gets used see Finding the used JRE on Windows using Process Explorer for Windows, and Finding the JRE used by a Java application for other platforms.)