How to run multiple ranorex tests from command line ?

Best practices, code snippets for common functionality, examples, and guidelines.
hghesani
Posts: 4
Joined: Mon May 21, 2018 7:55 pm

How to run multiple ranorex tests from command line ?

Post by hghesani » Fri Oct 12, 2018 8:41 pm

Hi

I am aware that we can run one ranorex test from command line. Like the following :

YourTestSuite.exe /tc:TestCaseName

But lets say as a part of continuous integration I am dynamically generating a test list which is different everytime. Is there a way to run multiple cases from command line without doing the following :

YourTestSuite.exe /tc:TestCaseName1
YourTestSuite.exe /tc:TestCaseName2
YourTestSuite.exe /tc:TestCaseName3

I would prefer something that is scriptable so that I can have TestCaseName1, TestCaseName2 and TestCaseName3 run together after creating a configuration dynamically or modifying the rxtst files dynamically.

Please let me know.

Thanks

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

Re: How to run multiple ranorex tests from command line ?

Post by krstcs » Mon Oct 15, 2018 2:25 pm

If your CI system is passing a list of test cases that need to be run, then you can do a for loop over that list in a batch command with your generic test EXE name like you have it, but parameterize the testcase like "/tc:%%<t>", where "<t>" is the name of your loop variable.

See this site for batch commands and usage: https://ss64.com/nt/for.html

Since you don't name your CI system or give the actual format of the list being generated, we're probably not going to be able to give much more specific help.
Shortcuts usually aren't...

TimoL
Posts: 4
Joined: Thu Sep 13, 2018 3:08 pm

Re: How to run multiple ranorex tests from command line ?

Post by TimoL » Mon Oct 22, 2018 1:43 pm

I have a question related to this. I have the following simplified structure:

Project
Test suite 1
TC1
TC2
TC11
TC22

I want to run the test cases TC1 and TC2 regularly from Jenkins, but TC11 and TC22 only by hand from Ranorex. The test cases uses same modules which are used within that test suite only. What would be the best way to proceed?

a) Run multiple testcases in one Jenkins build. Seems that this is not possible as told above. Command line argument “/tc:TC1 /tc:TC2” does not work
b) move test cases TC11 and TC22 under a new test suite, Test suite 2 under the same project. Then run Test suite 1 in Jenkins
c) move TC1 and TC2 under a new smart folder and run that smart folder in Jenkins
d) something else?

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

Re: How to run multiple ranorex tests from command line ?

Post by odklizec » Mon Oct 22, 2018 2:00 pm

Hi,

The easiest way to achieve what you want is to use Run configuration, as described here:
https://www.ranorex.com/help/latest/ran ... igurations
Simply define first run configuration(e.g. called JenkinsRun), which will contain TC1 and TC2. Then second run configuration (e.g. called ManualRun), which will contain TC11 and TC22. Then in jenkins job config, you need to define proper run configuration, via Ranorex command line arguments (/rc:RunConfigName). Hope this helps?
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

TimoL
Posts: 4
Joined: Thu Sep 13, 2018 3:08 pm

Re: How to run multiple ranorex tests from command line ?

Post by TimoL » Tue Oct 23, 2018 8:26 am

Thanks, this was an easy solution!