Fitnesse integration

Could you help with Fitnese (http://fitnesse.org/) integration with TC. I had this ability in Hudson and would be great to have the same in  TC. As far as I see it does not support OTB.
May be you  have any solution to parse results from fitnesse reports.
Thank you.

11 comments
Comment actions Permalink

Hi

It's not supported out of the box yet, but TeamCity allows to publish custom HTML reports in build results.

If' you're using Maven builds then it can be integrated via Trinidad plugin.
Also I saw a rather tricky solution with converting of XML reports into JUnit's format that's supported by TeamCity.
http://stackoverflow.com/questions/2225212/display-fitnesse-xml-reports-within-hudson-gui
http://andypalmer.com/2009/04/showing-fitnesse-test-results-in-hudson/

Please vote for this feature request in TW-2636.

Michael

0
Comment actions Permalink

Thank you for your answer. I already tried to convert results to JUnit format, it works, but it is not so suitable for use.

0
Comment actions Permalink

May be it would be useful for guys how will read this topic in the future - I have write simple plugin for Fitnesse integration to TeamCity https://github.com/EKibort/TeamCityFitnessePlugin

0
Comment actions Permalink

Eduard,

I have found your plugin and it looks like it's exactly what I need.  However, I've not had any luck getting it installed on our Windows build server.

I've built the plugin using the "deploy.bat" file and it copies the .zip into the directory under %USERPROFILE%.  

A few issues I see:

  1. When the new command window opens to attempt to restart the agent, it hangs and never completes.
  2. A "rebuild" of the plugins directory doesn't happen.



Any assistance you could provide would be greatly appreciated.

0
Comment actions Permalink

The Custom report option (plus creating a tab for the results.zip) + Teamcity messaging system (for publishing the test results) works very well, when integrating fitnesse and teamcity.

ziv shapira

0
Comment actions Permalink

Hi Rob,
You should place Fitnesse.zip to Plugins directory under the data directory and restart teamcity service.

0
Comment actions Permalink

You can import report as html , but you will not have reports on test page and other tests functionality of TC.

0
Comment actions Permalink

I misunderstood what "data directory" meant.  I was doing all of the prescribed things on the "build agent" machines not the "build server" machine.

Thank you for the assistance everyone.  If you hit cement (my head) hard enough, long enough, it will crack!  :)

0
Comment actions Permalink

Eduard

I have posted this issue on GitHub but thought I would have more chance of getting help quicker if I post here too.

I have built the package and dropped it into the [Team City Data Directory] on the server.  The plugin is listed in the Admin area as an external plugin but I don't see it in the list of build runners when I try to add a build step.  I checked the logs TC and found the following exception:

Error loading class [Fitnesse.server.Controller] for bean with name 'TeamCityFitnesseController' defined in URL [file:/C:/TeamCity/temp/spring-Fitnesse6352418311010925379-spring.config.tmp.xml]: problem with class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: Fitnesse/server/Controller : Unsupported major.minor version 51.0

It looks like there are some compatability problems with the plugin and TC 7.*.  Any ideas what I need to do with the source code to solve this problem?  

Mike

0
Comment actions Permalink

Be sure that you use Java 6  to build plugin. You should use java from TC (like "C:TeamCity\jre\bin\")

0
Comment actions Permalink

I know this is old, but I needed to solve this issue, but didn't have access to install plugins on the TeamCity server.

My approach was to create an XSLT within the TeamCity job (I used powershell to dump it into a file), then a second powershell step to apply the XSL transform.

I got the transform from here: https://woodybrood.github.io/articles/2012/01/26/Transforming-FitNesse-Results-to-Junit.html however there are a couple of typos there, so I've fixed them here.

My first powershell step just dumped the transform out to a file (alternatively you can just put the file into a common location on your buildagent, or put it into your VCS so it gets checked out as part of your build):

$outFile = ".\transform.xslt";
Set-Content $outFile "<?xml version=`"1.0`" encoding=`"UTF-8`"?>"
Add-Content $outFile "<xsl:stylesheet version=`"1.0`" xmlns:xsl=`"http://www.w3.org/1999/XSL/Transform`">"
Add-Content $outFile "<xsl:template match=`"/`">"
Add-Content $outFile "<xsl:element name=`"testsuite`">"
Add-Content $outFile "<xsl:attribute name=`"tests`">"
Add-Content $outFile "<xsl:value-of select=`"sum(suiteResults/finalCounts/*)`" />"
Add-Content $outFile "</xsl:attribute>"
Add-Content $outFile "<xsl:attribute name=`"failures`">"
Add-Content $outFile "<xsl:value-of select=`"suiteResults/finalCounts/wrong`" />"
Add-Content $outFile "</xsl:attribute>"
Add-Content $outFile "<xsl:attribute name=`"disabled`">"
Add-Content $outFile "<xsl:value-of select=`"suiteResults/finalCounts/ignores`" />"
Add-Content $outFile "</xsl:attribute>"
Add-Content $outFile "<xsl:attribute name=`"errors`">"
Add-Content $outFile "<xsl:value-of select=`"suiteResults/finalCounts/exceptions`" />"
Add-Content $outFile "</xsl:attribute>"
Add-Content $outFile "<xsl:attribute name=`"name`">"
Add-Content $outFile "<xsl:value-of select=`"suiteResults/rootPath`" />"
Add-Content $outFile "</xsl:attribute>"
Add-Content $outFile "<xsl:for-each select=`"suiteResults/pageHistoryReference`">"
Add-Content $outFile "<xsl:element name=`"testcase`">"
Add-Content $outFile "<xsl:attribute name=`"classname`">"
Add-Content $outFile "<xsl:value-of select=`"/suiteResults/rootPath`" />"
Add-Content $outFile "</xsl:attribute>"
Add-Content $outFile "<xsl:attribute name=`"name`">"
Add-Content $outFile "<xsl:value-of select=`"name`" />"
Add-Content $outFile "</xsl:attribute>"
Add-Content $outFile "<xsl:attribute name=`"time`">"
Add-Content $outFile "<xsl:value-of select=`"runTimeInMillis div 1000`" />"
Add-Content $outFile "</xsl:attribute>"
Add-Content $outFile "<xsl:choose>"
Add-Content $outFile "<xsl:when test=`"counts/exceptions > 0`">"
Add-Content $outFile "<xsl:element name=`"error`">"
Add-Content $outFile "<xsl:attribute name=`"message`">"
Add-Content $outFile "<xsl:value-of select=`"count/exceptions`" />"
Add-Content $outFile "<xsl:text> exceptions thrown </xsl:text>"
Add-Content $outFile "<xsl:if test=`"counts/wrong> 0`">"
Add-Content $outFile "<xsl:text> and </xsl:text>"
Add-Content $outFile "<xsl:value-of select=`"counts/wrong`" />"
Add-Content $outFile "<xsl:text> assertions failed </xsl:text>"
Add-Content $outFile "</xsl:if>"
Add-Content $outFile "</xsl:attribute>"
Add-Content $outFile "</xsl:element>"
Add-Content $outFile "</xsl:when>"
Add-Content $outFile "<xsl:when test=`"counts/wrong > 0`">"
Add-Content $outFile "<xsl:element name=`"failure`">"
Add-Content $outFile "<xsl:attribute name=`"message`">"
Add-Content $outFile "<xsl:value-of select=`"counts/wrong`" />"
Add-Content $outFile "<xsl:text> assertions failed </xsl:text>"
Add-Content $outFile "</xsl:attribute>"
Add-Content $outFile "</xsl:element>"
Add-Content $outFile "</xsl:when>"
Add-Content $outFile "</xsl:choose>"
Add-Content $outFile "</xsl:element>"
Add-Content $outFile "</xsl:for-each>"
Add-Content $outFile "</xsl:element>"
Add-Content $outFile "</xsl:template>"
Add-Content $outFile "</xsl:stylesheet>"

The second step is the following powershell script that applies that transform. Just note that you'll need to ammend paths/filenames to suit your own case:

$dir = "<my path to where the fitnesses results are>";
$XSLT = "transform.xslt"; ## You may need your path for where this file lives

## I am getting the first XML file, as for my case that is the parent result file.
## You may need to adjust this for your own case
$XMLFileName = Get-ChildItem -Path $dir -Filter *.xml -ErrorAction SilentlyContinue -Force;
$XMLInputFile = $dir + $XMLFileName;
$XMLOutputFile = "summary.xml";

Try
{
$settings = New-Object System.Xml.Xsl.XsltSettings($true,$true);
$resolver = New-Object System.Xml.XmlUrlResolver;

$xslt = New-Object System.Xml.Xsl.XslCompiledTransform;
$xslt.Load($XSLT,$settings,$resolver);

$xslt.Transform($XMLInputFile,$XMLOutputFile);
}
Catch
{
$ErrorMessage = $_.Exception.Message
$FailedItem = $_.Exception.ItemName
Write-Host 'Error'$ErrorMessage':'$FailedItem':' $_.Exception;
return 0
}
return 1

Lastly, you then add a "Build Feature" item to your job, of type "XML Report Processing", and select "Ant JUnit", filename of "summary.xml" which it should pick up from your working folder.

0

Please sign in to leave a comment.