Command line arguments

Ranorex Spy, Recorder, and Studio.
david.rubio
Posts: 6
Joined: Mon Oct 06, 2014 12:32 pm

Command line arguments

Post by david.rubio » Tue Oct 07, 2014 10:24 am

Hello,

In the project properties I can see under Debug tab that there is a field to pass Command Line arguments which works fine. I see one can store the args in a .user-file which it works indeed but I cannot find that file. Can anyone help me? My idea is to create a file which will be used by the projects to get the args required.

Thanks
David

david.rubio
Posts: 6
Joined: Mon Oct 06, 2014 12:32 pm

Re: Command line arguments

Post by david.rubio » Tue Oct 07, 2014 3:30 pm

Ok, I found it. The file can be located at <Project_Root>/project_name/project_name.csproj.user

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Command line arguments

Post by krstcs » Tue Oct 07, 2014 3:44 pm

Note that the csproj_user file is not copied to the output directory when compiling. Also, it cannot be "Added" to the project as it is considered a project file already and is not visible to the user, it is just for storing user settings.

My suggestion would be to use a batch file instead and just run the tests from the batch. Just put the information you want passed into Ranorex in the batch and add the batch file to the project so it is maintained along with the rest of the code.
Shortcuts usually aren't...

david.rubio
Posts: 6
Joined: Mon Oct 06, 2014 12:32 pm

Re: Command line arguments

Post by david.rubio » Tue Oct 07, 2014 3:56 pm

Thanks for your reply krstcs.

How do I add the batch file to the project in Ranorex? Do you mean adding to the batch file something like the following?

Code: Select all

.\excutable /arg1 value1 /arg2 value2
I would like to use it in Jenkins too

Thanks

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Command line arguments

Post by krstcs » Tue Oct 07, 2014 6:26 pm

Ah, if you are going to use Jenkins, then no batch file is necessary. Just set up your jobs as Windows Batch Scripts and put the script in the way you want. You can also add run-time parameters to the job that can be passed to Ranorex.


The format for command line scripting with Ranorex is like this (assuming a test called MyTest):

MyTest.exe /param:<Global Paramater Name>="<Value to pass in>"


You should read up on command line parameters in the User Guide - Command Line Parameters.


I use Jenkins as well, and once you get it set up, it is much easier to use than batch files.
Shortcuts usually aren't...

david.rubio
Posts: 6
Joined: Mon Oct 06, 2014 12:32 pm

Re: Command line arguments

Post by david.rubio » Wed Oct 08, 2014 8:42 am

Thanks again krstcs for yor help. That was exactly what I was doing and I'm going to stick with it because what I was trying to achieve with the .user-file does not give me anything much better than Jenkins.

protherrobot
Posts: 1
Joined: Sat Oct 11, 2014 2:02 pm

Re: Command line arguments

Post by protherrobot » Sat Oct 11, 2014 2:11 pm

david.rubio wrote:Ok, I found it. The file can be located at <Project_Root>/project_name/project_name.csproj.user
Thanks David for giving this information as i was facing the same situation of not getting files .