ranorex

Add action-numbers in Ranorex Reports


In Ranorex, is there a way to output the number of the action that is being executed in the test report? By default, this is not output, but would mean a faster orientation in the error analysis. In the corresponding report tab in the test-suite I did not find a corresponding checkbox.


Solution

  • Ranorex support wrote me accordingly on 3/25/2023 that such a feature does not yet exist - but they will plan for it in the future. Until then, you can use the following hack:

    TestSuite -> Properties -> Report -> Report template: Create custom template

    Add those two snippets in RanorexReport.xsl:

    1. line 645 - <th> with the headline: ActionNumber (Codeline)

               (...)
               <div class="module-container">
                   <xsl:choose>
                       <xsl:when test=".//item">
                           <div class="module-header">
                               <xsl:call-template name="levelFilterSelector" />
                           </div>
                           <div class="module-report">
                               <TABLE border="0" cellSpacing="0" class="reporttable">
                                   <thead>
                                       <th>
                                           <b>ActionNumber (Codeline)</b>
                                       </th>
                                       <th>
                                           <b>Time</b>
                                       </th>
                                       <th>
                                           <b>Level</b>
                                       </th>
                                       <th>
                                           <b>Category</b>
                                       </th>
                                       <th>
                                           <b>Message</b>
                                       </th>
                                   </thead>
                                   (...)
      
    2. line 839 - <td> with the actionnumber and codeline itself

       (...)
       <xsl:template name="itemrow">
           <xsl:param name="tablerowclass" />
           <xsl:param name="type" />
      
           <tr class="{$tablerowclass}" style="{@style}" onMouseOver="DisplayHoverMenu(this)" onMouseOut="HideHoverMenu(this)">
               <td>
                   <xsl:if test="metainfo/@itemindex and not(@category='Section')">
                       <xsl:value-of select="./metainfo/@itemindex - count(preceding-sibling::item[@category='Section']) + 1"/>
                   </xsl:if>
                   <xsl:if test="./metainfo/@codeline">
                       <xsl:text> (</xsl:text>
                       <xsl:value-of select="./metainfo/@codeline"/>
                       <xsl:text>)</xsl:text>
                   </xsl:if>
               </td>
               <td class="timeCell">
                   <xsl:value-of select="./@time" />
               </td>
               <td class="levelCell">
                   <xsl:value-of select="./@level" />
               </td>
               <td class="categoryCell">
                   <xsl:value-of select="./@category" />
               </td>
               (...) 
      

    Find comparison of both xsl here.

    Note: The actionnumbers for UserCode-Actions are not written into the .rxlog.data by Ranorex. They cannot be added with this xsl hack, which only manipulates the transformation of the .rxlog.data into the .rxlog.