Fitnesse - Getting Started

> Test - Software, Framework and Library > Test - Fitnesse Framework

1 - About

A little getting started guide for fitness

Advertising

3 - Steps

3.1 - Installation

3.2 - BasicTest with a DecisionTable

Slim has several test written in table format.

We will use the decision table

|eg.Division|
|numerator|denominator|quotient?|
|10       |2          |5        |
|12.6     |3          |4.2      |
|100      |4          |33       |

where

  • eg specifies a Java package (or other language namespace), and Division specifies the actual class to be called.
  • the rows are processed from left to right,
  • the input values are headers without a question mark ?
  • the input values are passed to the corresponding fields using setter functions
  • the expected value are the header with a question mark (ie quotient?)

This decision table would test this Java class:

Division.java
public class Division {
  private double numerator, denominator;
 
  public void setNumerator(double numerator) {
    this.numerator = numerator;
  }
 
  public void setDenominator(double denominator) {
    this.denominator = denominator;
  }
 
  public double quotient() {
    return numerator/denominator;
  }
}
Advertising

3.3 - Test Run

You can run a test with one of the following options:

3.3.1 - Web Page

When you are on a web page, you can start a run with:

  • the Test button at the top of the page.
  • shortcut ALT-t from a web page

3.3.2 - Http request

Http request example: http://localhost/FitNesse.UserGuide.TwoMinuteExample?test&format=text

Starting Test System: slim:fitnesse.slim.SlimService.
F 11:43:36 R:5    W:1    I:0    E:0    TwoMinuteExample	(FitNesse.UserGuide.TwoMinuteExample)	0.307 seconds
--------
1 Tests,	1 Failures	0.719 seconds.

Doc: http://fitnesse.org/FitNesse.UserGuide.AdministeringFitNesse.RestfulServices

You can see in the output that the engine is slim

Advertising

3.3.3 - Command line

Command line example:

java -jar fitnesse-standalone.jar -c "MyTestPage?test&format=text"

REM Example
java -jar fitnesse-standalone.jar -c "FitNesse.UserGuide.TwoMinuteExample?test&format=text"
Starting Test System: slim:fitnesse.slim.SlimService.
F 14:38:15 R:5    W:1    I:0    E:0    TwoMinuteExample (FitNesse.UserGuide.TwoMinuteExample)   0.470 seconds
--------
1 Tests,        1 Failures      1.152 seconds.
echo %ERRORLEVEL%
1

3.3.4 - Ant