How to pass multiple values for a single argument when running tests from command line

Best practices, code snippets for common functionality, examples, and guidelines.
ziasim
Posts: 43
Joined: Wed Dec 16, 2015 4:03 pm

How to pass multiple values for a single argument when running tests from command line

Post by ziasim » Wed Oct 03, 2018 3:06 pm

Hi,

I am trying to run scripts on remote machine using PSEXEC along with passing some arguments. I can successfully pass one value for each argument like /rc:Test1 or /pa:Server_Machine_Name=TestMachine and tests are running OK.

But, I want to send multiple values for a specific type of argument like I would like to send multiple values to set my multiple global parameters. I tried like this

/pa: Server_Machine_Name=TestMachine SQL_UserName=sa (only picks first value, ignores second value)

or

/pa: Server_Machine_Name=TestMachine, SQL_UserName=sa (error occurred)

or

/pa: Server_Machine_Name=TestMachine /pa:SQL_UserName=sa (only picks second value, ignores first parameter)

Nothing is working yet.

Is there a way to pass multiple values for a single argument type while running tests from command line/PSEXEC???

Note- I am running PSEXEC within windows batch command on Jenkins.

Thanks in advance???

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to pass multiple values for a single argument when running tests from command line

Post by odklizec » Wed Oct 03, 2018 3:24 pm

Hi,

Since you are using Jenkins, why are you using psexec? The best and most reliable way to run tests on remote machine, is to setup Jenkins slave on target test machine and then simply use Ranorex own Jenkins plugin or Jenkins batch command run step.

BTW, please post complete psexec command you are using.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

ziasim
Posts: 43
Joined: Wed Dec 16, 2015 4:03 pm

Re: How to pass multiple values for a single argument when running tests from command line

Post by ziasim » Wed Oct 03, 2018 3:49 pm

Since you are using Jenkins, why are you using psexec?
Our setup is like we have Jenkins master/slave setup. We want to use slave to build ranorex test solution after that we will be pushing AUT and RTS(ranorex test solution) to some remote machine to start script execution. That's the reason I am using PSEXEC to start execution on remote VM. We are NOT running tests on Jenkins slave machine.

BTW, please post complete psexec command you are using.
Here is the command I am using to send multiple values for a specific argument

C:\Windows\SysWOW64\PSTools\psexec.exe -i 1 -w \\%NewVMComputerName%\C$\Users\Administrator\Desktop\Ranorex\Debug \\%NewVMComputerName% -u %NewVMComputerName%\Administrator -p <password> -accepteula "C:\Users\Administrator\Desktop\Ranorex\Debug\%BuildProjectName%.exe" /rc:ServerInstallation /rc:ConsoleInstallation /pa:SQL_UserName=sa /pa:To=%BUILD_USER_EMAIL%

User avatar
Stub
Posts: 173
Joined: Fri Jul 15, 2016 1:35 pm

Re: How to pass multiple values for a single argument when running tests from command line

Post by Stub » Thu Oct 04, 2018 8:15 am

I too use this format for passing multiple parameters to the Ranorex test executable via the command-line:

Code: Select all

/pa: Server_Machine_Name=TestMachine /pa:SQL_UserName=sa
I don't use PSExec, my command-line call is baked into MSBuild. I do put double quotes around my parameter values when they include spaces, though that isn't relevant here given your examples. But perhaps you need the double quotes around the email address component in your latter example?
Last edited by Stub on Thu Oct 04, 2018 8:21 am, edited 1 time in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to pass multiple values for a single argument when running tests from command line

Post by odklizec » Thu Oct 04, 2018 8:21 am

Hi,

Agree with Stub. This way of passing multiple parameters in command line should work just fine. I'm using it too, just not via psexec. And while it should not make a difference, I too would eliminate the space after pa: ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Stub
Posts: 173
Joined: Fri Jul 15, 2016 1:35 pm

Re: How to pass multiple values for a single argument when running tests from command line

Post by Stub » Thu Oct 04, 2018 8:23 am

I also noticed the space after I code-d the example above, Pavel, but I think that's probably just a typo from the earlier examples since it's not present in the actual data shown in the subsequent update post. That email address variable looks more suspect to me now.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to pass multiple values for a single argument when running tests from command line

Post by odklizec » Thu Oct 04, 2018 11:21 am

BTW, I still think that starting the test suite via psexec (or another form of remoting) is not as reliable and in fact redundant, in case there is already configured Jenkins? I'm too using certain machines for build and another for tests, but everything is handled from Jenkins jobs. First (build) job simply builds the test on one machine, then in case of successful build, it starts second (test) job, which copies the build artifacts from first machine and starts the test on second machine. All is handled with Jenkins jobs and works quite good. Psexec just adds another level of complexity and possible source of problems so why to bother with it? ;)
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

ziasim
Posts: 43
Joined: Wed Dec 16, 2015 4:03 pm

Re: How to pass multiple values for a single argument when running tests from command line

Post by ziasim » Thu Oct 04, 2018 12:05 pm

After putting parameter values in double quotes and making sure that no space is present after pa:, it is working now.

Just for info, I also tried sending multiple values to one global parameter as part of this testing like /pa:To="%BUILD_USER_EMAIL%, [email protected]" which also worked. I need this thing as I want to send emails to multiple persons using Email module of Ranorex Helper.

Thanks Pavel and Stub for your help :)