Possibilty to use variables in Report files name?

Ask general questions here.
MiHa
Posts: 3
Joined: Wed Jan 04, 2017 9:58 am

Possibilty to use variables in Report files name?

Post by MiHa » Wed Jan 04, 2017 10:17 am

Hi,

I'm new in Ranorex and like to know if there is a way to use varibales in the Report file names?

Background:
We want to automate our hardware-product final tests, so we need to assign the product s/n to the report.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Possibilty to use variables in Report files name?

Post by Support Team » Thu Jan 05, 2017 2:56 pm

Hi MiHa and welcome to the Ranorex forum,

Unfortunately the Ranorex Report does only allow the following variables when executed via Test Suite
  • %T Time
    %D Day
    %M Month
    %Y Year
    %L Run Label
    %C Run Config Name
    %H Host Name
    %S Test Suite Name
    %X Test Suite Result
If you execute your test via command line or via ci tool, you could take advantage of the /rf parameter, which allows you to pass any value as name.
More information about the different command line arguments can be found in our User Guide

Regards,
Markus (S)
.
Image

MiHa
Posts: 3
Joined: Wed Jan 04, 2017 9:58 am

Re: Possibilty to use variables in Report files name?

Post by MiHa » Thu Jan 05, 2017 5:04 pm

Hi Support Team,

I have seen these variables, but the needed input were generated in the test.

Is it possible to modify the "%L" variable and what does this variable include as default?

Otherwise can I rename the reportfiles at the "TearDown" Section with a test variable?

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

Re: Possibilty to use variables in Report files name?

Post by odklizec » Fri Jan 06, 2017 10:14 am

Hi,

I don't know about %L variable, but I have a good experience with renaming the rxzlog file name via code. You just need to perform below actions as very last actions in program.cs:

Code: Select all

	Ranorex.Core.Reporting.TestReport.EndTestCase();
	Ranorex.Core.Reporting.TestReport.SaveReport();
	// get rxzlog path 
	string zipFilePath = Ranorex.Core.Reporting.TestReport.ReportEnvironment.ReportZipFilePath;
	// add custom string to report file name
	string customString = "blablabla";
	if (System.IO.File.Exists(zipFilePath))  
	{
		string zipFilePath_new = Ranorex.Core.Reporting.TestReport.ReportEnvironment.ReportFileDirectory + "\\" + Ranorex.Core.Reporting.TestReport.ReportEnvironment.ReportName + "_" + customString + ".rxzlog";
		System.IO.File.Move(zipFilePath, zipFilePath_new);	
	}
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