About
ColumnFixture maps table columns directly to:
- properties,
- methods
- and fields
of the fixture class.
It is very useful for repetitive verification (as parameterized test) if the same test needs to be repeated for different combinations of input arguments.
Similar to Slim - Decision Table (test case as a row)
Articles Related
Format
- The first row of the table is the fixture test class name.
- The second row map column names to a field or method (where the Output values must have a question mark ? after the column name).
- All following rows list combinations of input arguments and expected values of output arguments.
Example
Doc
!|info.fitnesse.fixturegallery.ColumnFixtureTest|
|firstPart|secondPart|together?|totalLength?|
|Hello|World|Hello, World|10|
|Houston|We Have a Problem|Houston, We Have a Problem|24|
where:
- info.fitnesse.fixturegallery.ColumnFixtureTest is the class to test
- firstPart and secondPart are the input value
- together and totalLength'' are the ouput tested
- the test data is
|Hello|World|Hello, World|10|
|Houston|We Have a Problem|Houston, We Have a Problem|24|
Example of test class:
package info.fitnesse.fixturegallery;
import fit.ColumnFixture;
public class ColumnFixtureTest extends ColumnFixture {
public String firstPart;
public String secondPart;
private int length;
public String together(){
length=firstPart.length()+secondPart.length();
return firstPart+ ", "+secondPart;
}
public int totalLength(){
return length;
}
}