Previous page: DoFixture Next page: ArrayFixture Parent page: FitLibrary Fixtures


SequenceFixture is very similar to DoFixture and has almost the same features — in fact the only difference between those two is the naming convention for methods. Instead of using odd cells to construct a method name, SequenceFixture takes the first cell in each row as the method name, and all other cells as arguments (if there are no keywords to modify the row functionality). All DoFixture keywords are supported in SequenceFixture too, as well as the flow mode (see Flow Mode ) and domain object wrapping (see System under test).

Table Format

The table format is the same as for DoFixture (see DoFixture), with the difference in method naming.

|check|char at|4|x|
|set list|A,B,C,D|
|check|char at|2|C|

Fixture class

The fixture class should extend fitlibrary.SequenceFixture . Declare public methods for all verifications and actions by taking the first cells as the method name, and using all other cells as arguments.

Java Source Code

package info.fitnesse.fixturegallery;
import java.util.Arrays;
import fitlibrary.SequenceFixture;

public class SequenceFixtureTest extends SequenceFixture{
	public String letters;
	public void fill(int count,char c){
		char[] arr=new char[count];
		letters=new String(arr);
	public void setList(char[] array){
		letters=new String(array);
	public char charAt(int position){
		return letters.charAt(position);

.NET Source Code

using System;

namespace info.fitnesse.fixturegallery
    public class SequenceFixtureTest : fitlibrary.SequenceFixture
        private String contents;
        public void Fill(int howmany, String what)
            contents = "";
            for (int i = 0; i < howmany; i++)
                contents = contents + what;
        public void SetList(String[] strings)
            contents = "";
            foreach (String s in strings)
                contents = contents + s;
        public char CharAt(int index)
            return contents[index];

Python Source Code

from fitLib.SequenceFixture import SequenceFixture
from info.fitnesse.fixturegallery.typeadapter import buildListTypeAdapterFor

class SequenceFixtureTest(SequenceFixture):
    _typeDict = {}

    def __init__(self):
        self.letters = ""

    _typeDict["fill.types"] = [ None, "Integer", "Char" ]
    def fill(self, count, c):
        self.letters = c * count    #< FILL: Repeact char count times.

    # JAVA: public void setList(char[] array){
    ARRAY_OF_CHAR_TYPE_ADAPTER = buildListTypeAdapterFor("Char")
    _typeDict["setList.types"] = [ None, ARRAY_OF_CHAR_TYPE_ADAPTER ]
    def setList(self, array):
        self.letters = "".join(array)   #< Concatenate array of chars to string.

    _typeDict["charAt.types"] = [ "Char", "Integer" ]
    def charAt(self, position):
        return self.letters[position]


SequenceFixture has all the flexibility and power of DoFixture , but without the silly method names. It is most useful for more technical workflow tests, especially to directly mapSystem under test).

Previous page: DoFixture Next page: ArrayFixture Parent page: FitLibrary Fixtures