question

ipsTeam avatar image
ipsTeam asked ipsTeam posted

Combining web and Swing sessions

Hi Fanfare,

 

We have to automate one of the web applications(IDM) for sensors using iTest.

Basically we launch the application using an IP address .Eg: https://10.89.149.204/

 

This leads us to a web page where we have a button "RUN IDM" to launch the application.375iED88DCB792D33DA0 

 

When we click on Run IDM the .jnlp file gets downloaded and the application is launched automatically

When we try to login to IDM using Itest through a web session , we get a system window asking us to save the .jnlp file.

But this window is not captured by iTest.

 

How can we go about automating this scenario.

 

PS: Right now we have downloaded the .jnlp files and are using swing sessions to test it.We need a way where both  the web and swing session can be combined

 

iTestGUI Testing(Web-Java Swing-etc)
idm.JPG (90.5 KiB)
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ipsTeam avatar image
ipsTeam answered ipsTeam posted

We have to automate one of the web applications(IDM) for sensors using iTest.

Right now we have got a Launcher to access the sensor application.(Launcher is installed in the system).

 

The properties in the launcher shows the following: (The target field in the properties)

 

Target : C:\WINDOWS\system32\javaw.exe -Xms64m -Xmx512m -Dsun.swing.enableImprovedDragGesture=true -classpath file1.jar;file2.jar;launcher.jar;file3.jar com.launcher.Launcher

 

 

We have the following questions:

 

  • What are the variables that needs to be set so that the swing session gets initiated.(The Location of the Jar file to launch , class to launch , working folder ,classpath )
  • Are there any additional variables that needs to be set.
  • Could you please tell me which type of session best suits such an application.
7 comments
10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

ramarb avatar image ramarb commented ·

Created a batch file with the below info and launched it, but it says could not create JVM.

 

----

javaw.exe -Xms64m -Xmx512m -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 -Dsun.swing.enableImprovedDragGesture=true -classpath file1.jar;file2.jar;launcher.jar;file3.jar com.launcher.Launcher

-------

 

Preet,

 

I gave itest jar path in .bat file, and trying to invoke application which could not launch. Any comments?

0 Likes 0 ·
PreetS avatar image PreetS ramarb commented ·

The Javaagent HAS to be to the first argument.

Move the "-Xms64m -Xmx512m" args later down the command line.

0 Likes 0 ·
ipsTeam avatar image ipsTeam PreetS commented ·

Hi Preet ,

 

In Scenario 1 : where i said i have downloaded the .jnlp file and tried to run it on itest , Now when i use the URL (https://<ip_ address>/path/path.jnlp) for the same the complete session window gets hanged and I cant perform any operations on the session window.

385iF7CC917B4D864594

 

In Scenario 2 : Moved the args "-Xms64m -Xmx512m" later down the command line , but am still facing the same issue.(could not create JVM)

 

 

0 Likes 0 ·
session.JPG (68.0 KiB)
KumarS avatar image KumarS ipsTeam commented ·

JNLP support in iTest needs improvement. We are working on improving it and it should be available in a future release. In the mean while, what we have found is that each JNLP case seems to require assistance of Fanfare AE or engineer to get it up and running. I would recommend contacting your Fanfare AE or Fanfare Support to set up a breeze meeting to resolve this issue.

0 Likes 0 ·
PreetS avatar image PreetS KumarS commented ·

From my experience, passing JVM arguments has always been problematic with Java webstart. There are numerous bugs filed against it on the sun-java website. 

 

What I have found, through experience, is that the best way to pass the arguments for JNLP is using environment variables. 

 

Here is a sample batch file. Please adjust the paths for iTest, javaws, and url appropriately. 

 

 

set ITEST_HOME=C:\Program Files\Fanfare\iTest 4.0\

set SWING_RESOURCES=%ITEST_HOME%plugins\com.fnfr.svt.applications.java.swing.resources_4.0.0.49612\

set JAVAWS=C:\Program Files\Java\jdk1.5.0_07\bin\javaws.exe

set JAVA_TOOL_OPTIONS=-javaagent:"%SWING_RESOURCES%SwingTestHarness.jar" -Xbootclasspath/a:"%SWING_RESOURCES%SwingTestHarnessInterfaces.jar";"%SWING_RESOURCES%SwingTestHarness.jar";"%SWING_RESOURCES%xmlwriter-2.2.jar"

"%JAVAWS%" -verbose -wait http://java.sun.com/javase/technologies/desktop/javawebstart/apps/swingset2.jnlp

 

 

 

 

If this approach fails, you may want to use javaws.exe shipped with the JDK rather than the JRE. A customer of fanfare resolved a similar problem by doing this.

0 Likes 0 ·
amandaysu avatar image amandaysu PreetS commented ·

Hi,

I tried to launch our gui by a.bat like below:

set JAVA=C:\Program Files\Java\jdk1.6.0_20\bin\java.exe
set JAVAWS=C:\Program Files\Java\jdk1.6.0_20\bin\javaws.exe

set JAVA_TOOL_OPTIONS=-javaagent:"D:\iTest\plugins\com.fnfr.svt.applications.java.swing.resources_4.1.3.59718\SwingTestHarness.jar" -Xbootclasspath/a:"D:\iTest\plugins\com.fnfr.svt.applications.java.swing.resources_4.1.3.59718\SwingTestHarnessInterfaces.jar;D:\iTest\plugins\com.fnfr.svt.applications.java.swing.resources_4.1.3.59718\SwingTestHarness.jar;D:\iTest\plugins\com.fnfr.svt.applications.java.swing.resources_4.1.3.59718\xmlwriter-2.2.jar"
 
set iTestSwingServerPort=5030
 
set iTestSwingServerPath=D:\iTest\plugins\com.fnfr.svt.applications.java.swing.resources_4.1.3.59718\runserver.bat

"%JAVAWS%" -verbose https://<ip>

but it said "Unable to launch the application"

 

the exception is

java.io.FileNotFoundException: https:\<ip>(The filename, directory name, or volume label syntax is incorrect)
 at java.io.FileInputStream.open(Native Method)
 at java.io.FileInputStream.<init>(Unknown Source)
 at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
 at com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
 at com.sun.javaws.Main.launchApp(Unknown Source)
 at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
 at com.sun.javaws.Main$1.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)

0 Likes 0 ·
Neelakantam avatar image Neelakantam amandaysu commented ·

Hi, if you found solution on this please let me know Regards Neelakantam

0 Likes 0 ·
PreetS avatar image
PreetS answered PreetS posted

At this point with iTest, you cannot test the Web and the Swing side together. 

 

For now, the only way to test is using a batch file launcher for the JNLP file. You could use the URL of the JNLP file rarther than downloading it. That way you won't have to actually start a web session before starting the swing session. 

 

For the web part, you could test the web interface independently - just the web part. 

 

There is already a feature request to achieve what you are trying to do smoothly, and we are working on ways to make this better. 

10 |950

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.