Previous page: CombinationFixture Next page: SetFixture Parent page: FitLibrary Fixtures
ConstraintFixture
ConstraintFixture is a variation of CalculateFixture (see CalculateFixture) that has an expected value of true for each calculation.Table Format
The first row of the table is the fixture class name. After that, the second row contains names for input parameters. All rows after that specify values for the input parameters.
!|ConstraintFixtureTest|
|firstPart|secondPart|
|1|2|
|2|3|
Fixture class
The fixture class should extend fitlibrary.ConstraintFixture . It should declare a boolean method with a name concatenated from all parameter names (in this case firstPartSecondPart ).Java Source Code
package info.fitnesse.fixturegallery;
import fitlibrary.ConstraintFixture;
public class ConstraintFixtureTest extends ConstraintFixture{
public boolean firstPartSecondPart(int firstPart,int secondPart){
return firstPart<secondPart;
}
}
.NET Source Code
using fitlibrary;
using System;
namespace info.fitnesse.fixturegallery
{
public class ConstraintFixtureTest: ConstraintFixture
{
public bool FirstPartSecondPart(int firstPart,int secondPart)
{
return firstPart<secondPart;
}
}
}
Python Source Code
# PYTHON: info.fitnesse.fixturegallery.CombinationFixtureTest
from fitLib.ConstraintFixture import ConstraintFixture
class ConstraintFixtureTest(ConstraintFixture):
_typeDict = {}
# PY3K: firstPartSecondPart(firstPart : int, secondPart : int) : bool
_typeDict["firstPartSecondPart.types"] = [ "Boolean", "Int", "Int" ]
def firstPartSecondPart(self, firstPart, secondPart):
return firstPart < secondPart
Previous page: CombinationFixture Next page: SetFixture Parent page: FitLibrary Fixtures
Add Child Page to ConstraintFixture