Reply
Community Leader
PreetS
Posts: 413
Registered: 09-03-2008

How to test Swing application launched via Java Web Start (JNLP files)

JNLP files are used to launch java applications served by a web server using Java Web Start.

 

First you need to have Java Web Start installed on your machine. If you have JDK, it is in the bin folder of your installation. (File name: javaws)

You can launch an application by pointing javaws to the URL of the JNLP file.

For example, to launch a demo swing application, the command would be:

 

javaws http://java.sun.com/javase/technologies/desktop/javawebstart/apps/swingset2.jnlp

 

Now, to make it talk to iTest, this needs to be started with the iTest jvm arguments. javaws lets you specify these arguments with the -J option. 

 

So, to launch it with iTest args, the command would look like:

 

 

javaws -J-javaagent:{iTest Swing resources folder}\SwingTestHarness.jar -J-Xbootclasspath/a:{iTest Swing resources folder}\SwingTestHarnessInterfaces.jar;{iTest Swing resources folder}\SwingTestHarness.jar;{iTest Swing resources folder}\xmlwriter-2.2.jar http://java.sun.com/javase/technologies/desktop/javawebstart/apps/swingset2.jnlp

 

where  {iTest Swing resources folder} is the path to the swing resources folder in your iTest installation. This folder is located at iTestHome/plugins/com.fnfr.svt.applications.java.swing.resources.*

 

You should put this command in a .bat file (.sh for UNIX based systems)

 

Now, you can launch this batch file from iTest swing session.  In the Swing session profile, select the property "Launch a custom application" and provide the batch file in the "Command to launch the application". You will see a splash screen and after loading all the required JAR files, the application will load, ready to be tested. 

 

Community Leader
AdeelM
Posts: 96
Registered: 09-01-2008
0

Re: How to test Swing application launched via Java Web Start (JNLP files)

All paths need to be in double quotes.

 

On my machine {iTest Swing resources folder} is C:\Program Files\Fanfare\iTest 3.3.1\plugins\com.fnfr.svt.applications.java.swing.resources_3.3.1.34823.

 

So my batch file looks like:

 

javaws -J-javaagent:"C:\Program Files\Fanfare\iTest 3.3.1\plugins\com.fnfr.svt.applications.java.swing.resources_3.3.1.34823\SwingTestHarness.jar" -J-Xbootclasspath/a:"C:\Program Files\Fanfare\iTest 3.3.1\plugins\com.fnfr.svt.applications.java.swing.resources_3.3.1.34823\SwingTestHarnessInterfaces.jar";"C:\Program Files\Fanfare\iTest 3.3.1\plugins\com.fnfr.svt.applications.java.swing.resources_3.3.1.34823\SwingTestHarness.jar";"C:\Program Files\Fanfare\iTest 3.3.1\plugins\com.fnfr.svt.applications.java.swing.resources_3.3.1.34823\xmlwriter-2.2.jar" http://java.sun.com/javase/technologies/desktop/javawebstart/apps/swingset2.jnlp

 



 

Community Leader
AdeelM
Posts: 96
Registered: 09-01-2008
0

Re: How to test Swing application launched via Java Web Start (JNLP files)

How does this command change for Linux?

 

My javaws is located in /usr/jre1.6.0_13/bin/ folder.

 

The following command works in shell. It launches SwingSet2 application as expected.

 

 

/usr/jre1.6.0_13/bin/javaws http://java.sun.com/javase/technologies/desktop/javawebstart/apps/swingset2.jnlp

 

 

But iTest on Linux does not seem to understand the following command. I get a javaws splash screen which goes away after about 5 seconds. Then nothing happens. 

/usr/jre1.6.0_13/bin/javaws -J-javaagent:"/root/Fanfare/iTest_3.3/plugins/com.fnfr.svt.applications.java.swing.resources_3.3.1.34823/SwingTestHarness.jar" -J-Xbootclasspath/a:"/root/Fanfare/iTest_3.3/plugins/com.fnfr.svt.applications.java.swing.resources_3.3.1.34823/SwingTestHarnessInterfaces.jar";

"/root/Fanfare/iTest_3.3/plugins/com.fnfr.svt.applications.java.swing.resources_3.3.1.34823/SwingTestHarness.jar";

"/root/Fanfare/iTest_3.3/plugins/com.fnfr.svt.applications.java.swing.resources_3.3.1.34823/xmlwriter-2.2.jar" http://java.sun.com/javase/technologies/desktop/javawebstart/apps/swingset2.jnlp

 

 

 Any ideas?

  

 

Community Leader
PreetS
Posts: 413
Registered: 09-03-2008
0

Re: How to test Swing application launched via Java Web Start (JNLP files)

On linux, the path separator is ':' not ';'

:)

Community Leader
AdeelM
Posts: 96
Registered: 09-01-2008
0

Re: How to test Swing application launched via Java Web Start (JNLP files)

Replaced ";" with ":"

 

Still does not work. My command looks like this:

 

/usr/jre1.6.0_13/bin/javaws -J-javaagent:"/root/Fanfare/iTest_3.3/plugins/com.fnfr.svt.applications.java.swing.resources_3.3.1.34823/SwingTestHarness.jar" -J-Xbootclasspath/a:"/root/Fanfare/iTest_3.3/plugins/com.fnfr.svt.applications.java.swing.resources_3.3.1.34823/SwingTestHarnessInterfaces.jar":

"/root/Fanfare/iTest_3.3/plugins/com.fnfr.svt.applications.java.swing.resources_3.3.1.34823/SwingTestHarness.jar":

"/root/Fanfare/iTest_3.3/plugins/com.fnfr.svt.applications.java.swing.resources_3.3.1.34823/xmlwriter-2.2.jar" http://java.sun.com/javase/technologies/desktop/javawebstart/apps/swingset2.jnlp

 

 

 

 

 

 

Member
ivano
Posts: 4
Registered: 07-23-2009
0

Re: How to test Swing application launched via Java Web Start (JNLP files)

Hi All,

 

Has something changed since iTest 3.3 ? I was able to launch the application via Java Web Start in iTest 3.3 according to the information posted. I upgraded to iTest 3.4 and adapted the bat file to match the new path,

when I start this Swing session profile referencing the bat file, my Java applet starts fine, but the iTest session window  says "Wainting for iTest to connect to the application" and eventually times out.

 

Any idea about this? 

Community Leader
PreetS
Posts: 413
Registered: 09-03-2008
0

Re: How to test Swing application launched via Java Web Start (JNLP files)

Just a hunch. 

 

When you add iTest JVM arguments, add this one too:

-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl

 

(refer to http://forums.fanfaresoftware.com/fnfr/board/message?board.id=GUI&message.id=365

 

Also,  double check your batch file to ensure you have your PATHS set correctly. 

 

If it does not help, please contact Fanfare Support.

 

Community Leader
PreetS
Posts: 413
Registered: 09-03-2008

Re: How to test Swing application launched via Java Web Start (JNLP files)

ivano,

 

We have realized that the JNLP launcher (javaws) has a bug in newer versions of JDK.

If you install JDK 1.6.0.6 on your machine and use the "javaws" provided in this JVM, then this should start working again

Member
ivano
Posts: 4
Registered: 07-23-2009
0

Re: How to test Swing application launched via Java Web Start (JNLP files)

PreetS,
 That did the trick for me! This is the bat file I use to launch application via JNLP file in iTest 3.4.1.

 

cd C:\Program Files\Java\jdk1.6.0_06\bin
javaws -J-javaagent:"C:\Program Files\Fanfare\iTest 3.4\plugins\com.fnfr.svt.applications.java.swing.resources_3.4.1.40936\SwingTestHarness.jar" -J-Xbootclasspath/a:"C:\Program Files\Fanfare\iTest 3.4\plugins\com.fnfr.svt.applications.java.swing.resources_3.4.1.40936\SwingTestHarnessInterfaces.jar";"C:\Program Files\Fanfare\iTest 3.4\plugins\com.fnfr.svt.applications.java.swing.resources_3.4.1.40936\SwingTestHarness.jar";"C:\Program Files\Fanfare\iTest 3.4\plugins\com.fnfr.svt.applications.java.swing.resources_3.4.1.40936\xmlwriter-2.2.jar" -J-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl "my path to JNLP file"

 

thank you for helping.

 

 

 

 

 


Member
kn_reddy
Posts: 5
Registered: 02-25-2010
0

Re: How to test Swing application launched via Java Web Start (JNLP files)

Hi,

 

I am new to iTest and We are trying to analyze iTest options to start using it in our EMS GUI test automation. I have iTest 3.4 and  jdk1.6.0_06 installed in my system. I am not able to launch swing application via java web start, I am using the following command in .bat file,

when I start the Swing session profile referencing the bat file, the sample Java applet listed in bellow code starts fine, but the iTest session window  says "Waiting for iTest to connect to the application" and eventually says "Unable to connect to the application". Please help me to resolve this issue.

 

 

 

javaws -J-javaagent:"C:\Program Files\Fanfare\iTest 3.4\plugins\com.fnfr.svt.applications.java.swing.resources_3.4.0.39755\SwingTestHarness.jar" -Xbootclasspath/a:"C:\Program Files\Fanfare\iTest 3.4\plugins\com.fnfr.svt.applications.java.swing.resources_3.4.0.39755\SwingTestHarnessInterfaces.jar";"C:\Program Files\Fanfare\iTest 3.4\plugins\com.fnfr.svt.applications.java.swing.resources_3.4.0.39755\SwingTestHarness.jar";"C:\Program Files\Fanfare\iTest 3.4\plugins\com.fnfr.svt.applications.java.swing.resources_3.4.0.39755\xmlwriter-2.2.jar" -J-Djavax.xml.parsers.DocumentBuilderFactory=com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl http://java.sun.com/javase/technologies/desktop/javawebstart/apps/swingset2.jnlp