Showing screenshots in Jenkins of Ranorex Report

Ranorex Spy, Recorder, and Studio.
ElSticky
Posts: 34
Joined: Tue Sep 17, 2013 1:45 pm

Showing screenshots in Jenkins of Ranorex Report

Post by ElSticky » Wed May 28, 2014 11:31 am

So I followed the article http://www.ranorex.com/blog/make-your-r ... sing-xunit to get some detailed information about my Ranorex tests in Jenkins.

I would like to add the screenshot to the stacktrace output when a test fails but it looks like Jenkins does not continue reading after Stack trace output.

This is my code in the changed XSL file:

Code: Select all

          <!-- Provide Details (Stacktrace) in case of a Failure -->
          <xsl:choose>
            <xsl:when test="@result='Failed'">
              <xsl:element name="failure">
                <xsl:attribute name="message">
                  <xsl:value-of select="normalize-space(errmsg)"></xsl:value-of>
                </xsl:attribute>
                  <xsl:value-of select="normalize-space(.//item/metainfo/@stacktrace)"></xsl:value-of>
				  <!--<img src="{.//item/@errimg}" width="100" height="100"/>-->
				  <p>
				  TEST
				  </p>
				  <img>
					<xsl:attribute name="src">
						$WORKSPACE\<xsl:value-of select="normalize-space(.//item/@errimg)"/>
					</xsl:attribute>
					<xsl:attribute name="width">
						100
					</xsl:attribute>
					<xsl:attribute name="height">
						100
					</xsl:attribute>
				  </img>
              </xsl:element>
            </xsl:when>
          </xsl:choose>
So the stack trace is shown properly, but paragraph "TEST" and the image aren't shown. Also when looking at the source of the page you won't see anything of it.

Does anyone know why this is "ignored"?

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

Re: Showing screenshots in Jenkins of Ranorex Report

Post by krstcs » Wed May 28, 2014 3:21 pm

I run Jenkins and the HTML Publisher plugin. This plugin allows me to post the whole report to Jenkins and it will put links to the report in each build/run. It is a bit of a pain to get setup, but once you do, it is much easier than manual publishing.

I would recommend that you set your Ranorex Report to have an html extension. I use Report.html and Report.html.data. I would also put the report in a separate folder. My is in a Report folder under the test executable's folder. This will make it easier to setup the HTML Publisher plugin.

MyTest
-Report (Dir)
---Report.html
---Report.data.html
---RanorexReport5.* (or whatever the names are...)
-MyTest.exe
-MyTest.rxtst, etc
Shortcuts usually aren't...

ElSticky
Posts: 34
Joined: Tue Sep 17, 2013 1:45 pm

Re: Showing screenshots in Jenkins of Ranorex Report

Post by ElSticky » Mon Jun 02, 2014 11:59 am

Thanks for the tip, I've installed this plugin to Jenkins and it works fine with Ranorex Reports in html format. Only thing I had to do to view them in Chrome is installing the IETab plugin because otherwise the ActiveX-objects are not loaded.