Monday, March 22, 2010

Running FitNesse Test in Your Automated Build

If you are creating automated acceptance tests you should be including them in your automated build. Here are a few options for including FitNesse in an automated build.


FitNesse comes with a set of Ant tasks that can be used for running tests. Below are the targets that I use in GivWenZen:

<target name="load_fitnesse_taskdef">
<taskdef classpathref="fitnesse.classpath"
resource="" />
<target name="execute_fitnesse_tests"

<start-fitnesse wikidirectoryrootpath="${basedir}"
fitnesseport="${fitnesse.port}" />

<execute-fitnesse-tests suitepage="GivWenZenTests"
classpathref="fitnesse.classpath" />

<stop-fitnesse fitnesseport="${fitnesse.port}" />

The FitNesse output states that the ant target is deprecated and should be replaced with the FitNesse rest commands. The ant target example from the FitNess site is below:

<target name="my_fitnesse_tests">
<java jar="dist/fitnesse.jar"
<arg value="-c"/>
<arg value="FitNesse.MySuitePage?suite&format=xml"/>
<arg value="-p"/>
<arg value="9234"/>


The hudson plugin for FitNesse is very easy to configure and use. Once it has been installed and hudson has been restarted set the path to the FitNesse xml output file for your build.


I am not a big fan of maven but there is a maven plugin for FitNesse and info for it can be found at


  1. Szczepan Faber pointed out to us that we can just use Junit to run them using the JunitHelper class that ships with FitNesse. The test looks something like

    import fitnesse.junit.JUnitHelper;
    import org.junit.Before;
    import org.junit.Test;

    public class RunFitnesseTests {

    public void testFitnesse() throws Exception {
    final JUnitHelper helper = new JUnitHelper("path/to/FitNesseRoot", "results/go/here");

    I didn't have any luck with the maven fitnesse plugin. I was using the trinidad plugin for a while, but running through junit let us cut that out.

  2. thanks Kelly, I always forget about this option. Can you still create the xml output for reporting purposes?

  3. yes you can, even create junit xml files to get hudson test history working with that.

  4. Could you help me to setup the plugin for my existing fitnesse project ?

    My current project setup:

    1. I have my fixture code as a java project (It is a separate maven project).
    2. The fitnesse wiki as a separate maven project.
    3. We are running the fitnesse server manually from the fitnesse wiki project and adding the fitnesse pages. We are manually configured the .class files path of fixture code project in each page.

    Now we want to run the fitnesse tests / suits as part of maven build as we are planning for Continuous Integration.

    Kindly help me out.

    I am stuck with this task from last 2 weeks.

    Tried many pluggins but they didn't work for me.

    After looking at your blog felt that this approach may help me out.

    Thank you,