Fit - Row Fixture

About

RowFixture tests dynamic lists of objects. It will compare the expected list (FitNesse table) with the actual result (from fixture code) and report any additional or missing items.

similar to:

Format

  • The first row of the table is the fixture class name.
  • The second row describes the structure of objects in the list (the properties or methods that you want to verify).
  • All rows after that describe expected objects in the array.

Implementation

The fixture class should extend fit.RowFixture and override the following two methods:

  • getTargetClass — returns the Type or Class object representing the type of objects contained in the array.
  • query — returns the actual array of objects to be verified.

Example

  • Row table
!include -seamless SetUpFixture

!|RowFixtureTest|
|name|post code|
|John Smith|SW4 66Z|
|Michael Jordan|NE1 8AT|
  • Fixture class implementation
package info.fitnesse.fixturegallery;

import info.fitnesse.fixturegallery.domain.Player;
import fit.RowFixture;

public class RowFixtureTest extends RowFixture{
	public Class getTargetClass() {
		return Player.class;
	}
	public Object[] query() throws Exception {
			return Player.players.toArray();
	}
}

Documentation / Reference


Powered by ComboStrap