FitNesse. UserGuide. FixtureGallery. FitLibraryFixtures.
CombinationFixture [add child]

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

CombinationFixture

CombinationFixture is used to perform an operation on pairs on values. The values are specified in a row and a column and the operation is performed on all combinations of values.

Table Format

The first row of the table is the fixture class name. The second row contains an empty cell followed by cells containing the values to be used as the second parameter for the operation. All subsequent rows contain a value in the first cell to be used as the first parameter for the operation, followed by cells containing the expected value of the operation.


!|CombinationFixtureTest|
| |1 |2|3|
|6 |6 |3|2|
|12|12|6|4|

Fixture class

The fixture class should extend fitlibrary.CombinationFixture . It should declare a method combine which takes two values (row and column) and returns a value.

Java Source Code


package info.fitnesse.fixturegallery;

import fitlibrary.CombinationFixture;

public class CombinationFixtureTest extends CombinationFixture{
public int combine(int theFirst, int theSecond) {
return theFirst / theSecond;
}
}

.NET Source Code


using fitlibrary;

namespace info.fitnesse.fixturegallery {
public class CombinationFixtureTest: CombinationFixture {
public int combine(int theFirst, int theSecond) {
return theFirst / theSecond;
}
}
}

Python Source Code


# PYTHON: info.fitnesse.fixturegallery.CombinationFixtureTest
from fitLib.CombinationFixture import CombinationFixture

class CombinationFixtureTest(CombinationFixture):
_typeDict = {}

# PY3K: combine(theFirst : int, theSecond : int) : int
_typeDict["combine.types"] = [ "Int", "Int", "Int" ]
def combine(self, theFirst, theSecond):
return theFirst / theSecond

Usage

CombinationFixture can be used to describe calculation rules that depend on exactly two arguments.


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