Highlighted
XsiSec Absent Member.
Absent Member.
689 views

2 different applications

Hello Everyone,


I am running two different applications in one Silk4net project.


Mainframe (Terminal) and Java application(with Swing components).

I also have made two different Test cases, (one per application)
Also I have created one "*.objectmap" per application.

Now is my problem when I run the test-case for the java-application
Only RumbaPage is started not the java-application.


So how do I associate a application per test?

if a setting-file is needed please provide me with an example if it's possible.



Thank you in advance

 

Regards


Xsi

0 Likes
3 Replies
Micro Focus Expert
Micro Focus Expert

RE: 2 different applications

Hi,

I assume you have test a scenrio that interacts with both application in one test case.

If this the case, it would be easiert to just create two projects (one the Rumba application and one for the Java application).

 

If you need both applications in one project, you can use the BaseState class to determinte which application you want to start.

Please note that "new BaseState()" refers to the first application in your Silk4NET project.

Example:

new BaseState().Execute(); // this will start RumbaPage.exe

You can create a different base state and use that for your Java application.

Example:

string pathToExecutable = "C:/Java/bin/jp2launcher.exe"

string commandLineArgs = "...."; // specify the required command line args for your application here

string locator = "...";  // locator or object map id for the main window of the Java application

new BaseState(pathToExecutable, commandLineArgs, locator).Execute(); // this will start your Java application

If you need help for getting the command line args, see this post: https://superuser.com/questions/415360/how-do-i-find-out-command-line-arguments-of-a-running-program

Hope that helps,

Regards, Michael

XsiSec Absent Member.
Absent Member.

RE: 2 different applications

Hi Michael Very helpful answer,

For me looks like the java application settings like -->

"C:\Program Files (x86)\Java\jre1.8.0_72\bin\javaws.exe" -localfile -J-Djnlp.application.href=localhost:8080/en_kdp_ppa_flit.jnlp "C:\Users\XXX\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\54\1e89df36-74260c70"

How do I parse that?

Thank you in advance

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: 2 different applications

Hi Xsi,

Is the "C:\Users\" part of the command line args or is it the working directory of the application?

Assuming it is the working directory, the code would be something like this:

 

var pathToExecutable = "C:\\Program Files (x86)\\Java\\jre1.8.0_72\\bin\\javaws.exe";

var commandLineArgs = "-localfile -J-Djnlp.application.href=localhost:8080/en_kdp_ppa_flit.jnlp";

var locator = "...";  // locator or object map id for the main window of the Java application

var baseState = new BaseState(pathToExecutable, commandLineArgs, locator);

baseState.WorkingDirectory = "C:\\Users\\XXX\\AppData\\LocalLow\\Sun\\Java\\Deployment\\cache\\6.0\\54\\1e89df36-74260c70";

baseState.Execute();

If this does not work try to start the app manually with the given executable, command line args, and working directory. For example, open a cmd.exe, "cd" to the working directory, and then start the executable with the command line args.
As a rule of thumb: If the combination of executable, command line args, and working directory correctly starts the application via cmd.exe then the same combination should also correctly start the application via the base state in Silk4NET.

Regards, Michael

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.