Page 1 of 1

How to add information to rxlog without expanding?

Posted: Mon Jul 14, 2014 9:59 am
by BCTest
Hi,

I have read lesson 8 of Ranorex-User-guid to see what functions are available to customize the rxlog: really great possibilities.
In my special case I want to add the revision number of our own application to the head of the rxlog, e.g. {test suite name} - {app revision} instead of {test suite name}. How can I add the revision number to the head of the rxlog without expanding any details?

Greetings

Re: How to add information to rxlog without expanding?

Posted: Mon Jul 14, 2014 5:57 pm
by krstcs
You could add a Global Parameter to your test suite called "SUT Revision" and store the tested revision info there. This would then be printed at the top of the report in the Global Parameters section.

Re: How to add information to rxlog without expanding?

Posted: Tue Jul 15, 2014 8:32 am
by BCTest
Yes, that's what I wanted: Thanks!

But one more question: where would be the best position in code to define a new value for this global parameter? I tried the following code to define a value for the global parameter:

Code: Select all

TestSuite.Current.Parameters["SUT Revision"]="5.5";
Where should I place this line of code?
I tried the Main-funtion in the Program.cs-file of the Test but this seems to be the wrong position.

Re: How to add information to rxlog without expanding?

Posted: Tue Jul 15, 2014 1:17 pm
by krstcs
Well, you could put it in the command-line with the /param: switch, that way whatever you are using to run the test would be responsible for updating the revision, such as a batch file or a continuous integration solution like Jenkins. This would be my recommendation.

Code: Select all

MyTest.exe /param:Revision="X.X.X.XXXX"


You could also create a small TestSetup module that does every thing you are wanting and just run it first in your suite, such as in the suite's Setup area. (Right-click the suite name and select "Show Setup/Teardown".

Re: How to add information to rxlog without expanding?

Posted: Tue Jul 15, 2014 3:10 pm
by krstcs
Also, I didn't notice the first time, but you have a SPACE character (" ") in your parameter name, which is not allowed. You need to take the space out or replace it with an UNDERSCORE ("_").

Re: How to add information to rxlog without expanding?

Posted: Wed Jul 16, 2014 8:00 am
by BCTest
krstcs wrote:Well, you could put it in the command-line with the /param: switch, that way whatever you are using to run the test would be responsible for updating the revision, such as a batch file or a continuous integration solution like Jenkins. This would be my recommendation.

Code: Select all

MyTest.exe /param:Revision="X.X.X.XXXX"
Great, this is exactly what I wanted!
RanorexRevision.png
Thanks.

---

Only one more question: I searched for a list of global parameters and didn't find any results: is there a list of global parameters available?

Re: How to add information to rxlog without expanding?

Posted: Wed Jul 16, 2014 2:45 pm
by krstcs
You can create whatever global parameters you want. They are tied to the test suite.

As for command-line parameters, you can look at the section in the user guide about running without Ranorex Studio. It gives all of the command-line parameters. http://www.ranorex.com/support/user-gui ... html#c3022 All you need to do is create global parameters and then put them in the command-line with the "/param:<Global Parameter>=<Value>" switch. NOTE: You can surround the <Value> with double quotes if you are setting a value that has spaces in it. For example, I have 3 global parameters that set my environment, test configuration, and test type. My command-line looks like this:

Code: Select all

TCS_WEB_LoginTests.exe /param:ENVIRONMENT="TEST" /param:CONFIG="IE11-Windows7" /param:TEST_TYPE="REGRESSION"
-ENVIRONMENT is which website/server the system is testing against.
-CONFIG is the BROWSER VERSION and OS, or just BROWSER for Chrome, FF, and Safari. My tests are browser independent for the most part, and are run by Jenkins, so Jenkins can manage where they run.
-TEST_TYPE is LOCAL, REGRESSION, or ALL, and determines which data set is used, my data rows are in SQL Server and all have a TINYINT value (0-255) that determines which tests it will be run in. 0=None, 255=ALL.

Anyway, you can use these command-line parameters (and others) to set your test configuration at run-time.

Re: How to add information to rxlog without expanding?

Posted: Thu Jul 17, 2014 9:06 am
by BCTest
Whow, I never knew what is possible!
Thanks!

Re: How to add information to rxlog without expanding?

Posted: Thu Jul 17, 2014 1:23 pm
by krstcs
OH, and I need to add that those parameters (ENVIRONMENT, CONFIG, TEST_TYPE) are all created by me in my tests. They are not standard to Ranorex. Just don't want anyone to start asking why they can't find them... :D My description was for your edification so you could see how I was doing things on the command-line.


And, you are very welcome!