Fixture Gallery

FitNesse resources

Test Driven .NET Development With FitNesse: A detailed guide on using FitNesse and TDD practices to build better .NET software

DbFit: Test-driven database development

Fixture Gallery: Straight-forward examples for the most common fixture types in .NET, Python and Java

FitNesse.Info: Links to other FitNesse related resources.

Getting Fit With .Net: Quick Introduction to Testing .Net Applications with FitNesse

FitNesse-related articles on this web site

Fixture Gallery is a cookbook for FIT/FitNesse tests. It provides developers with a quick overview of the most important fixture types and concepts for agile acceptance testing using the FIT framework. For each fixture type, this document explains the table format and fixture class structure and provides advice when to use and when not to use it. Each example is accompanied by the source code for Java, .NET and Python FIT implementations, in a form that can be easily copied and used as a template for similar fixtures.

Release 2.1 (2008-07-08) is available in three forms:

There is also a Portugese translation of release 2.1 (2008-08-11):

The source code for all the examples in Smalltalk, Python, .NET and Java is available from SourceForge. Get release 2.1 or browse the current development branch.

Intended audience

This document will be most useful to people who are already using FIT and FitNesse to some extent and know the basics, although experienced FIT/FitNesse users might also find a few new tricks here. This is not a good guide to help you get started with FIT or FitNesse. See Fitnesse.Info for a list of resources that will help you take that first step.

This is an open documentation effort — please contribute

My intention with the Fixture Gallery is to start an open documentation project where other people can contribute their notes and ideas about how best to use FIT/FitNesse fixtures. The source code for the document and all examples is hosted on SourceForge. Please help to make this document better either by directly changing it on SourceForge or by modifying the live wiki version on FitNesse.info.

Feedback

To leave comments or feedback, please use the form below.

17 thoughts on “Fixture Gallery

  1. Where can I find the version of the DoFixture that supports the following features…

    Some other shortcuts
    In order to write tests for a large .Net project more efficiently, I
    developed a few extensions for .Net Fit/FitNesse library:
     numeric comparisons >, >=, < and <= can be used in cells for checks
     Nullable types like int? and bool? work properly
     !blank keyword can be used to check if a string is not blank
     symbols (<<name) can be used as fixture parameters. Fixture will get the symbol value
    directly.
     Fixtures can handle object arguments (not just string arguments) with protected ArgsObjects
    array
    Those patches are not part of standard FitNesse distribution, but are free to use, and can be
    downloaded from http://gojko.net/fitnesse.

  2. Hi MUlmer,

    the patches are now obsolete. nullable type support was built into the main branch of fitnesse.net a while ago. Regarding blanks and numeric comparisons, you can load support for that using the Cell Handler Loader table.. Here’s an example that enables symbols:

    !|Cell Handler Loader|
    |load|SymbolSaveHandler|FitLibrary|
    |load|SymbolRecallHandler|FitLibrary|
    

    You can get objects from arguments using the GetArgumentInput method (see http://syterra.com/FixtureArguments.html).

  3. Pingback: Fit/Fitnesse Fixture Gallery at Dazed & Confused

  4. This is very good information. I would suggests adding information of the DomainAdapter idea in the latest FitLibrary and SuiteFixture. These work together well to allow you to have one fixture and talk more directly to domain objects.

  5. Kevin,

    The DomainAdapter in FitLibrary allows something similar to the GenericFixture you mentioned. It does not completely remove the ability in most complex cases for some ‘fixture’ code but it greatly reduces it and does not require a tester to know class names. The DomainAdapter is available in both .Net and Java versions of FitLibrary. It also offers several ways to do conversion from the strings in the test to your domain objects.

  6. Pingback: Ajude a traduzir a Fixture Gallery « Coding Dojo Floripa

  7. I’m building an automatic acceptance test tool leveraging Fitnesse. Because of troubles in latest test suites, i decided to send you this message, hope that i could get a solution.

    Our undertest application is a heavy GUI built in Java. To run it manually, we need a JVM with -Xms128M -Xmx256M. As we need to verify the business value via GUI, it ‘s mandatory
    to get the references of graphical widgets. To do that, i start the targeted application in method of a subclass of DoFixture

    public class MyOwnDoFixture extends DoFixture{

    public void startGUI(){

    Runnable r=new Runnable(){
    public void run(){
    MyMainClassInJarArchive.main(new String[0]); // We need to invoke it in a thread, not process. To get referecences of graphical widgets, the runnable r and MyOwnDoFixture
    // must be run in the same JVM
    }
    };
    new Thread(r).start();

    …….

    }

    public void traceAllComponents(){
    …..
    }

    }

    My wiki page contains following scripts

    |MyOwnDoFixture|

    |startGUI|

    |traceAllComponents|

    …..

    This implementation worked well with lighter application ( the same undertest application, but some modules are disabled), which requires less than 64 M of Java heap to run

    With the latest application, the graphical interface is partly frozen and crashed-prone.

    I used JConsole to see what happened in backgroud. When I start the Fitneese server at the port 8288, a JVM is instantiated to run the main method of the class Fitnesse. When I clicked on the ‘Test’ button in my wiki page, a new JVM is instantiated ( its connection on JConsole is : …. FitServer 8288 1 ( the counter of clicks on Test button) ). The default java heap size of this JVM is always 64M, and i don’t know how to customize it. That cause a critical problem as the undertest app is run in a JVM with 64M of java heap.

    I want to know if there is anyway to customize the java heap size of the last JVM ( what i need to put in config, what code snippet need to be amended )

  8. Pingback: Disponibilizada a versão em português da Fixture Gallery « Coding Dojo Floripa

  9. Hi Gojko,

    In the gallery the .NEt tests do not work out of the box. On the main page of the .NEt suite the classpath must change from ..\bin\*.dll to dotnet2\*.dll

  10. Gojko, would it be possible for you to add SLIM examples? In particular being able to download an executable Fitnesse wiki that demonstrates .NET support with SLIM would really be helpful.

  11. Hello, I need your help in order to solve several problems with Fitnesse:
    - When there is a “main” function in a C program, I cannot test the functions of this program.
    For example:

    int add (int a, int b)
    {
    return a + b;
    }

    void main (void) {
    int a = 1;
    int b = 2;
    int result = add (a, b);}

    How do I test the add function in Fitnesse?

    - Is it possible to test a Java or C + + application that allows you to move a
    cursor / an arrow / an image on a GUI using the arrow keys, and then be able to check it with fitnesse (by simulating the use of an arrow key and checking the result on the GUI)? Does ActionFixture allow doing it?

    I am investigating for over a month without success, I cannot find much information about Fitnesse. This work is crucial for my diploma and as time goes it gets more and more urgent every day.
    Would you be so kind to help me please, thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>