views:

394

answers:

2

hello,

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

A: 

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"&gt;
<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>
rogma
A: 

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.
Dan Woodward