Subset Fixture compares an actual collection of objects to its table of expected values. It is the same as
Array Fixture, except surplus objects in the actual collection are ignored, and order is not significant.
setup sample array |
column a | column b |
a | x |
a | y |
b | y |
Matching cells are marked.
when test is⇓
story test fixture |
check | test result |
sample subset |
column a | column b |
a | x |
a | y |
b | y |
|
sample subset |
column a | column b |
a | x |
a | y |
b | y |
|
|
sample subset |
column a | column b |
a | x |
a | y |
b | y |
| then result is |
sample subset |
column a | column b |
a | x |
a | y |
b | y |
|
Surplus rows and order are ignored.
when test is⇓
story test fixture |
check | test result |
sample subset |
column a | column b |
b | y |
a | x |
|
sample subset |
column a | column b |
b | y |
a | x |
|
|
sample subset |
column a | column b |
b | y |
a | x |
| then result is |
sample subset |
column a | column b |
b | y |
a | x |
|
Mismatched cells and missing rows are reported.
when test is⇓
story test fixture |
check | test result |
sample subset |
column a | column b |
n | o |
b | z |
|
sample subset |
column a | column b |
n missing | o |
b | z expected y actual At 0 expected z was y |
|
|
sample subset |
column a | column b |
n | o |
b | z |
| then result is |
sample subset |
column a | column b |
n missing | o |
b | z expected y actual At 0 expected z was y |
|