Grid Fixture compares a two-dimensional array of objects to its table of expected values. The values are compared positionally; there is no header row with member names.
Matching cells are marked.
| setup sample grid |
| 0 | 1 | 2 |
| a | b | c |
| d | e | f |
when test is⇓
| story test fixture |
| check | test result |
|
|
|
| then result is |
|
Mismatched cells are reported.
when test is⇓
| story test fixture |
| check | test result |
|
| sample grid |
| a | b | x expected c actual At 0 expected x was c |
| d | d expected e actual At 0 expected d was e | f |
|
|
| then result is |
| sample grid |
| a | b | x expected c actual At 0 expected x was c |
| d | d expected e actual At 0 expected d was e | f |
|
Missing and surplus rows are reported.
when test is⇓
| story test fixture |
| check | test result |
|
| sample grid |
| x missing | y | z |
| d | e | f |
| a surplus |
b |
c | |
|
| then result is |
| sample grid |
| x missing | y | z |
| d | e | f |
| a surplus |
b |
c | |
An empty grid is matched.
when test is⇓
| story test fixture |
| check | test result |
|
|
|
| then result is |
|
Duplicate rows are handled.
| setup sample grid |
| 0 | 1 | 2 |
| a | b | c |
| d | d | e |
| d | d | e |
when test is⇓
| story test fixture |
| check | test result |
|
|
|
| then result is |
|