Page 1 of 1

Java app

Posted: Wed Mar 06, 2013 9:59 am
by SirMisiek
Hi,
Just started to use Ranorex and facing some problem.
My java app gets connection string to database from a file. When i add new action to recording (Run Application) and specify .exe file, it cannot see this file, but when i record the same operation, it is ok. Do i need to specify some folders in repository?

My recording.cs file below:

Code: Select all

            Report.Log(ReportLevel.Info, "Application", "Run application 'D:\\Folder\\app.exe' with arguments '' in normal mode.", new RecordItemIndex(0));
            Host.Local.RunApplication("D:\\Folder\\app.exe", "", "", false);
            Delay.Milliseconds(0);
            
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left DoubleClick item 'TotalCommander801.AppExe3781952201303011602A' at 32;12.", repo.TotalCommander801.AppExe3781952201303011602AInfo, new RecordItemIndex(1));
            repo.TotalCommander801.AppExe3781952201303011602A.DoubleClick("32;12");
            Delay.Milliseconds(930);

Re: Java app

Posted: Thu Mar 07, 2013 8:03 am
by Support Team
Hello,

It is not necessary to specify a folder within the Repository in order to start an application.
Could you please give us more information about your test? How did you define the "Run Application" action?
Do you get any error messages?
Thank you!

Regards,
Bernhard

Re: Java app

Posted: Fri Mar 08, 2013 2:19 pm
by SirMisiek
On the beginning of recording, i choose "Add new Action" -> "Run Aplication" and then specify exe file with my app. I posted result in code above. I do not get any error from Ranorex. What else should i post?

Application is a java app, which connects to database. Connectionstring is taken from .properties file and app gets connection string only when i record mouse click on app, for example from total commander. With "Run Application" event there is only application start and it acts like there is no file .properties.

Re: Java app

Posted: Mon Mar 11, 2013 8:25 pm
by Support Team
I think you need to set the working directory for the application to ensure it finds the ".properties" file. In the call to the RunApplication method, pass the directory the application resides in as the third argument, in your case "D:\Folder".

Or if using the recorder, set the "Working directory" property for the "Run Application" action.

See the API documentation for more information:
http://www.ranorex.com/Documentation/Ra ... tion_3.htm

Regards,
Alex
Ranorex Team