User Acceptance Testing – with FitNesse

FitNesse: FitNesse is a web server, a wiki and an automated testing tool for software. It is based on Ward Cunningham’s Framework for Integrated Test and is designed to support acceptance testing rather than unit testing in that it facilitates detailed readable description of system function.

FitNesse allows users of a developed system to enter specially formatted input (its format is accessible to non-programmers). This input is interpreted and tests are created automatically. These tests are then executed by the system and output is returned to the user. The advantage of this approach is very fast feedback from users. The developer of the system to be tested needs to provide some support (classes named “fixtures”, conforming to certain conventions).

FitNesse is written in Java (by Robert C. Martin and others). The program first supported only Java, but versions for several other languages have been added over time (C++, Python, Ruby, Delphi, C#, etc.). [Source: wikipedia]

Fitnesse Architecture:


FitNesse works by executing Wiki pages which call custom written Fixtures. Fixtures are a bridge between the Wiki pages and the System Under Test (SUT), which is the actual system to test. These Fixtures can be written in many programming languages like Java, C#, and Ruby.. Whenever a Wiki test is executed, the Fixtures works by calling the System Under Test (SUT) with the appropriate parameters, execute a piece of business logic in the software system, and pass the results (if any) of the SUT back to the Wiki front-end, which in turn will visually indicate if a test has passed or not.

FitNesse has two test systems, SLIM and FIT. FIT is the older test system, and is no longer actively developed. However, recent plans indicate that FIT might be further developed. Because of the complexity to maintain and support FIT on different platforms, SLIM was created. SLIM is a lightweight version of the FIT protocol. One of the design goals of SLIM was to easily port implementations to different languages. Also, in contrast to FIT, SLIM doesn’t require any dependencies on the FitNesse framework in the Fixtures code, which makes writing fixtures more easy. [Source:]

Installing process:

  • Download “fitnesse-standalone.jar” from  fitnesse-jar
  • Now you need to run the following command “java -jar fitnesse-standalone.jar -p 9090”

Some fitnesse command line options :

  1. -p {80}-
  2. -d {.}
  3. r <page root directory> {FitNesseRoot}
  4. l <log directory> {no logging}
  5. e <days> {14} Number of days before page versions expire
  6. o omit updates
  7. a {user:pwd | userfilename} enable authentication.
  8.  i Install only, then quit.
  9.  c <command> execute single command.

Where -p define the port number for running the wiki server.

Running this command will extract a folder and run the fitnesse server on port 9090.

  • Now go to your browser and go to http://localhost:9090/ you will see the fitnesse home page
  • Go to the location of the jar you will find a folder “FitnesseRoot” it’s the root folder where all the wiki pages, tests, test suits are going to be created

If you want to setup fitnesse from maven you need to add the followings in your maven project from –

Now here is a common example to create a sample test. (It’s the most common and famous example 🙂 )

Simple calculator program’s acceptance testing with ftinesse tool :

There are 3 phase to build up this test

  1. Wiki test page
  2. Fixture class
  3. System under test

Wiki page : Wiki test page is the page where we create our decision table. A wiki page can have different property like Test page,Test suite, Static etc. For running a test a page should be a Test page or a Test suite where there is multiple test pages. First we are going to create a wiki test page.

  • Go to “http://localhost:9090/FrontPage” and click ‘edit’
  • Then write the following line for the name of your test page you want to create like this ‘ >MyFirstTest’ and click ‘Save’ you will get a page ‘MyFirstTest’. Every FitNesse page has a name in so-called camel-case format, in which the first letter is uppercase, and, at least, one other letter in the word is uppercase. You have to maintain this to create a page.
  • Now set the page property to ‘Test’
  • Now enter into the page and click edit and write the following code
!define TEST_SYSTEM {slim}
!path D:\Projects\TestFitnesseProject
| import |
| com.fitnesse.fixture |

!define COLLAPSE_SETUP {true}
!define COLLAPSE_TEARDOWN {true}
!| Division Program |
| Numerator | Denominator | quotient? |
| 10 | 2 | 5.0 |
| 12.6 | 3 | 4.2 |
| 22 | 7 | ~=3.14 |
| 9 | 3 | | 11 | 2 | | 10 | 1 | 10.0 |

Here two thing will be clear after describing other two phases. Here path is the project path where is your fixture code and system under test code is present.

Before creating our fixture class. but before that we will go to our SUT (System under test) phase

System under test : Now we will see our calculator program code.

package com.test.calculator;

public class Calculator {
    private float numerator;
    private float denominator;
    private float quotient;

    public Calculator(float numerator, float denominator) {
        this.numerator = numerator;
        this.denominator = denominator;
    public float getNumerator() {
        return numerator;
    public void setNumerator(float numerator) {
        this.numerator = numerator;
    public float getDenominator() {
        return denominator;
    public void setDenominator(float denominator) {
        this.denominator = denominator;
    public float getQuotient() {
        return numerator/denominator;

Fixture class : Now we will create a new class DivisionProgram which is our fixture class with the following code

package com.fitnesse.fixture;
import com.test.calculator.Calculator;

public class DivisionProgram {

 private float numerator;
 private float denominator;
 private float quotient;

 public void setNumerator(float numerator) {
 this.numerator = numerator;

 public void setDenominator(float denominator) {
 this.denominator = denominator;

 public float quotient() {
 Calculator calculator = new Calculator(numerator, denominator);
 this.quotient = calculator.getQuotient();
 return this.quotient;

This class will communicate with our wiki page. It will take the numerator and denominator from the decision table and pass in to our main program (SUT) and get the result and compare it with the expected result from the decision table. Now look at the decision table once again.At the top of the table we write our fixture class name ‘Division Program’. The column headers are the name of the setter and main methods of our fixture class. If we miss to set this name properly according to our fixture class we will get no method found error.

Now go to the wiki page for your test and click on ‘Test’ it will run the test and return the test result here is a sample of the result from my test run


It will match all the accepted result according to the input and generate a result.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a website or blog at

Up ↑

%d bloggers like this: