Display Fitnesse XML reports within Hudson GUI
Asked Answered
M

3

5

After running fitnesse test using testrunner, I get an xml file containing all the results. Now I can't figure out how to display those results within the hudson GUI for a specific job.

I've surfed the web, and what I found is a couple people modifying the xsd file from CruiseControl.NET, but nobody is actually showing it working!

If someone could help me out or point me in the right direction, that would be greatly appreciated.

Thank You. Yohann

Money answered 8/2, 2010 at 22:1 Comment(0)
E
3

I transform the xml output by an xslt from fitnesse to junit format and publish the tests results. Unfortunately, I was not able to get the html result of a failure displayed inside hudson, however it is not a real problem since all I want to know is if my acceptance tests are ok.

Below is a copy of the xslt I use.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
  <xsl:element name="testsuite">
    <xsl:attribute name="tests">
      <xsl:value-of select="sum(testResults/finalCounts/*)" />
    </xsl:attribute>
    <xsl:attribute name="failures">
      <xsl:value-of select="testResults/finalCounts/wrong" />
    </xsl:attribute>
    <xsl:attribute name="disabled">
      <xsl:value-of select="testResults/finalCounts/ignores" />
    </xsl:attribute>
    <xsl:attribute name="errors">
      <xsl:value-of select="testResults/finalCounts/exceptions" />
    </xsl:attribute>
    <xsl:attribute name="name">AcceptanceTests</xsl:attribute>
  <xsl:for-each select="testResults/result">
    <xsl:element name="testcase">
      <xsl:attribute name="classname">
        <xsl:value-of select="/testResults/rootPath" />
      </xsl:attribute>
      <xsl:attribute name="name">
        <xsl:value-of select="relativePageName" />
      </xsl:attribute>
      <xsl:choose>
        <xsl:when test="counts/exceptions > 0">
          <xsl:element name="error">
            <xsl:attribute name="message">
              <xsl:value-of select="counts/exceptions" />
              <xsl:text> exceptions thrown</xsl:text>
              <xsl:if test="counts/wrong > 0">
                <xsl:text> and </xsl:text>
                <xsl:value-of select="counts/wrong" />
                <xsl:text> assertions failed</xsl:text>
              </xsl:if>
            </xsl:attribute>
          </xsl:element>
        </xsl:when>
        <xsl:when test="counts/wrong > 0">
          <xsl:element name="failure">
            <xsl:attribute name="message">
              <xsl:value-of select="counts/wrong" />
              <xsl:text> assertions failed</xsl:text>
            </xsl:attribute>
          </xsl:element>
        </xsl:when>
      </xsl:choose>
    </xsl:element>
  </xsl:for-each>
  </xsl:element>
</xsl:template>
</xsl:stylesheet>
Earthling answered 1/3, 2010 at 18:50 Comment(1)
How do you get hudson to use this xslt? Is there a module somewhere or does one need to write a script?Impossibly
T
2

There are some changes coming to FitNesse that will support the return of junit formatted results. I'm not sure the exact date, but when they do, the need for a separate transform activity should go away.

It should be possible soon to run the test in hudson with the new -c command line argument to run the test and then run it a second time with a -c argument to request the latest results for the test in junit format. The same should apply for suites.

I will come back an update when the release is out that has that functionality working.

I'm back. The -c approach still has some work to do, however there is a new Hudson Plugin which you can install directly from within Hudson. It isn't the idea solution for my team right now, but it is working for some teams.

To get it:

  1. Upate to 1.350 or higher Hudson
  2. Click on Manage Hudson
  3. Select Available Plugins
  4. Search for FitNesse on the page
  5. Install that plugin
  6. Configure it t point to your fitnesse.jar and FitNesseRoot.
Tramontane answered 3/3, 2010 at 20:39 Comment(0)
O
2

Not sure if it's exactly what you're after but if you install the Fitnesse plugin, you can add a build step which outputs xml.

Execute Fitnesse Build Script

And then you can publish those results from the xml as a post-build action.

Publish fitnesse results report (from xml)

Ohare answered 23/7, 2013 at 7:57 Comment(1)
Don't know about the submitter, but this was exactly what I was looking for.Rodriguez

© 2022 - 2024 — McMap. All rights reserved.