How to add information to rxlog without expanding?

Ranorex Spy, Recorder, and Studio.
BCTest
Posts: 88
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

How to add information to rxlog without expanding?

Post by BCTest » Mon Jul 14, 2014 9:59 am

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

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

Re: How to add information to rxlog without expanding?

Post by krstcs » Mon Jul 14, 2014 5:57 pm

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.
Shortcuts usually aren't...

BCTest
Posts: 88
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: How to add information to rxlog without expanding?

Post by BCTest » Tue Jul 15, 2014 8:32 am

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.

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

Re: How to add information to rxlog without expanding?

Post by krstcs » Tue Jul 15, 2014 1:17 pm

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".
Shortcuts usually aren't...

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

Re: How to add information to rxlog without expanding?

Post by krstcs » Tue Jul 15, 2014 3:10 pm

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 ("_").
Shortcuts usually aren't...

BCTest
Posts: 88
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: How to add information to rxlog without expanding?

Post by BCTest » Wed Jul 16, 2014 8:00 am

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
Revision
RanorexRevision.png (3.24 KiB) Viewed 747 times
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?

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

Re: How to add information to rxlog without expanding?

Post by krstcs » Wed Jul 16, 2014 2:45 pm

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.
Shortcuts usually aren't...

BCTest
Posts: 88
Joined: Tue Jun 03, 2014 10:15 am
Location: Hamburg, Germany

Re: How to add information to rxlog without expanding?

Post by BCTest » Thu Jul 17, 2014 9:06 am

Whow, I never knew what is possible!
Thanks!

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

Re: How to add information to rxlog without expanding?

Post by krstcs » Thu Jul 17, 2014 1:23 pm

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!
Shortcuts usually aren't...