Page 1 of 1

Running tests on command line

Posted: Mon Feb 06, 2017 9:48 pm
by manalitatke
I am trying to execute my testcase using command line parameters as specified in the below topic:

Running Tests via Command Line


What happens is: If i try to execute my TestCase within the test suite by using this command: testcase|tc:<name or guid of test case>

It starts executing ( running) the entire test suite instead of the specified testcase.

Also, i tried to over ride my testcase parameters by using:
testcaseparam|tcpa:<name or guid of test case>:<parameter name>=<value>
(Creates or overrides values for testcase parameters specified in the test suite)

It does not over ride the testcase parameters, and again executes the entire test suite.

I specified my "TestSuiteName.exe" before navigating to the above specified commands as specified in the Keypass example.

Can someone please guide me through this? And let me know the command line parameters for running the specified test case instead of the suite and also how to over-ride the testcase parameters?

Thanks!

Re: Running tests on command line

Posted: Tue Feb 07, 2017 1:12 pm
by odklizec
Hi,

I guess the most probable reason of your problem is incorrectly used command line. Have you examined the command line examples, mentioned in Ranorex User Guide?

Please make sure the command line looks like this:

Code: Select all

TestSuiteName.exe /tc:TestCaseName /tcpa:TestCaseName:ParamName=12345
or like this...

Code: Select all

TestSuiteName.exe /testcase:TestCaseName /:TestCaseName:ParamName=12345
Simply replace TestCaseName and ParamName with your chosen TestCase name or Parameter name and also 12345 with value of your choice. Hope this helps ?

Re: Running tests on command line

Posted: Tue Feb 07, 2017 4:46 pm
by manalitatke
Hello,


Thanks for the response.

This works!

I had tried implementing commands similar to the specified, but maybe I did not navigate through the entire test case.

I have one more question:
My test was failing because my test case was bound to a variable I had parameterized for the test case.
The test passed only when I unbounded the variable and executed it on the command line.

Is there any way, we can still execute the test case via command line without changing the bound variables in the data binding of the test case.
The thing is, I have been developing the test case, and others do not want to get into the ranorex suite and change variables. Is there any way, this can be done via command line without the need for changing the data binding aspects of variables ( without making hard -code changes to the data binding variables).

Thanks again!

Re: Running tests on command line

Posted: Wed Feb 08, 2017 8:25 am
by odklizec
Hi,

If your test fails because of bound variables, the most probable reason is that the data passed to bound variables are wrong? So all you need to do is to run the test with with correct data. Are you sure the data are correct?

I don't know what you mean by this... "others do not want to get into the ranorex suite and change variables.". At first, if they there are more people working on the same test suite, they simply must be aware of others' people work. So if there are bound variables, they simply need to fill them with correct data while running the test.

If the test is properly designed, i.e. all variables are connected to respective data connectors (either CSV, Excel or DB), all you or anyone else have to do is to make sure the data connectors contain correct data. If you are extensively using test case parameters instead of data connectors, that's, in my opinion, wrong test design. You should definitely use data connectors instead of parameters. Parameters should be used only rarely and mainly for static things, which change only from time to time, due to special test needs or for passing values from one test/module to another.

But you see, without seeing your test suite, it's hard to tell what's really wrong, not to mention suggest something reliable and helpful ;)

Re: Running tests on command line

Posted: Wed Feb 08, 2017 4:10 pm
by manalitatke
Hello,

Thanks for the response. Sorry for being a bit unclear, since I am sort of a beginner with Ranorex.

I believe I have bound the variables correct, because I am able to implement them inside ranorex studio.

However, while I try to implement the test case using command line, since I am not specifying the bound variables on the command it gives me an error if the bound variables are enabled, and the test case fails through all the iterations.

Is there any way, I can implement the test case using variables which are bound to the test case, on command line?

What I meant "others do not want to get into the ranorex suite and change variables", is :

Myself, being in the test team, I am contributing to the development of the test suite and test cases. however, a developer who wants to integrate the Jenkins build server wants to implement the test cases via command line instead of making hard-code changes to the module variables in the ranorex studio.

Therefore, I am trying to figure out a way, wherein one can implement the test case using bound variables on command line.

Also, yes I used the Excel as a data connector for binding my test case variables( parameters) to the excel data.
While, also making sure that each parameter is mapped to the correct data( using excel data connector), all the iterations of the test case are running successfully inside ranorex studio.

However, they fail, if I implement them on command line using the commands mentioned in the second post.

Please let me know if this is clear and understandable.

Thanks!

Re: Running tests on command line

Posted: Fri Feb 10, 2017 2:39 pm
by qwertzu
Hi manalitatke,

I think there must be a slight misunderstanding.
Module Variables and the DataConnector can NOT be accessed via commandline.
Only Global Parameters can. I have attached a screenshot that should clearify this.
You can find more details about accessing parameters via command line here:
http://www.ranorex.com/support/user-gui ... html#c4827

I think, a solution for your problem could be following (I hope I understood correctly what you want):
You can create an Excel DataConnector in your TestSuite, that holds values. Those values then can be changed in the excel files outside of Ranorex Studio. So those people, who donĀ“t want to change values inside Ranorex Studio can change it in the excel file that is used as data connector in your project.
Inside your project, you should create variables that are bound with your data connector in order to use the values from the excel sheet. (But I think you already figured out how to get access to values in your data connector)

I hope I could help you on that.

Re: Running tests on command line

Posted: Fri Feb 10, 2017 10:37 pm
by manalitatke
Hii,

Thanks for the response.

Yes, as you said, this test runs fine on the ranorex studio, and I was looking forward for command line methods to execute them.

Thank you for the detailed clarification though :-)

Re: Running tests on command line

Posted: Wed Mar 08, 2017 3:36 pm
by MohBenista
Great! This thread was very helpful and helped me with the same problem! Thanks @manalitatke