Page 1 of 1

Possibilty to use variables in Report files name?

Posted: Wed Jan 04, 2017 10:17 am
by MiHa
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.

Re: Possibilty to use variables in Report files name?

Posted: Thu Jan 05, 2017 2:56 pm
by Support Team
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)

Re: Possibilty to use variables in Report files name?

Posted: Thu Jan 05, 2017 5:04 pm
by MiHa
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?

Re: Possibilty to use variables in Report files name?

Posted: Fri Jan 06, 2017 10:14 am
by odklizec
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);	
	}