Report Customization - Add Global Parameter

Ranorex Studio, Spy, Recorder, and Driver.
tiffin.filion
Posts: 56
Joined: Thu Oct 29, 2020 12:47 am

Report Customization - Add Global Parameter

Post by tiffin.filion » Fri Jul 02, 2021 3:31 am

Is there a way to display a global parameter in the header of the report? I've edited it a bit to show the user who's run the test, and it already shows the Test Suite name, but I'd also like to show the global parameter which is the URL that we are running the test on. Is there a way to do that?

The information I want is shown in a collapsed container, but I'd like it up higher so I don't need to expand the container before taking a screenshot of the header.

Image

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

Re: Report Customization - Add Global Parameter

Post by odklizec » Fri Jul 02, 2021 9:04 am

Hi,

Basically, you must modify both View.rxlog.data and RanorexReport.xsl files. Please see the attached screenshot and sample solution. Sadly, the forum attachment system appears to be broken again, so I'm uploading it to my google drive:
https://drive.google.com/file/d/1OP2ylv ... sp=sharing
https://drive.google.com/file/d/1vexex0 ... sp=sharing
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

tiffin.filion
Posts: 56
Joined: Thu Oct 29, 2020 12:47 am

Re: Report Customization - Add Global Parameter

Post by tiffin.filion » Fri Jul 02, 2021 6:31 pm

I noticed the images not being added to posts yesterday :D

Ok, so I get how to add the data to the report itself, but how do I get the parameter itself in there? It changes depending on which URL is entered in the global parameters (which we use in Jenkins too). Looking at the rxlog.data for a test I ran, it has the following for the parameter I want to appear at the top of the report:

Code: Select all

<params>
	<param
		name="URL">
		https://www.google.com
	</param>
</params>
How can I reference that parameter in the rxlog.data template? Currently, I have exactly what you put in for the Custom Property, but instead of "000" or whatever, what do I put there?

tiffin.filion
Posts: 56
Joined: Thu Oct 29, 2020 12:47 am

Re: Report Customization - Add Global Parameter

Post by tiffin.filion » Fri Jul 02, 2021 7:06 pm

I nearly have it.

Code: Select all

<tr>
  <td>
     <i class="field">
      URL Tested
      <b>
        <xsl:value-of select=".//param/@name" />
      </b>
    </i>
   </td>
 </tr>
 
Got me the name portion of the parameter. How do I get it to pull in the value?

Code: Select all

<params>
  <param
    name="URL">
    https://www.google.com
  </param>
</params>
Image

tiffin.filion
Posts: 56
Joined: Thu Oct 29, 2020 12:47 am

Re: Report Customization - Add Global Parameter

Post by tiffin.filion » Fri Jul 02, 2021 7:26 pm

I GOT IT! :D

Posting this here in case someone else has a similar question.

All I did was add a bracket around the parameter name to get me the value instead of the name of the parameter.

Code: Select all

<tr>
  <td>
    <i class="field">
      URL Tested
      <b>
        <xsl:value-of select=".//param[@name='URL']" />
      </b>
    </i>
  </td>
 </tr>