XmlFixture compares an XML document to the expected values in the table.
There is one row for each element. The first non-empty cell is the element name. The next cell is the concatentation of all child text nodes of the element, if any. The remaining cells are attribute name and value pairs for all attributes of the element, if any. If no text, the attribute cells follow immediately after the element name. The element tree structure is indicated by leading empty cells.
when test is⇓
story test fixture |
check | test result |
xml fixture under test |
root |
| child1 | some text |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
| | leaf | name | value |
| child3 |
|
xml fixture under test |
root |
| child1 | some text |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
| | leaf | name | value |
| child3 |
|
|
xml fixture under test |
root |
| child1 | some text |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
| | leaf | name | value |
| child3 |
| then result is |
xml fixture under test |
root |
| child1 | some text |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
| | leaf | name | value |
| child3 |
|
Missing and surplus elements are reported.
when test is⇓
story test fixture |
check | test result |
xml fixture under test |
root |
| child1 | some text |
| child1a |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
| | leaf | name | value |
|
xml fixture under test |
root |
| child1 | some text |
missing | child1a |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
| | leaf | name | value |
surplus |
child3 | |
|
xml fixture under test |
root |
| child1 | some text |
| child1a |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
| | leaf | name | value |
| then result is |
xml fixture under test |
root |
| child1 | some text |
missing | child1a |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
| | leaf | name | value |
surplus |
child3 | |
Out of order elements are reported.
when test is⇓
story test fixture |
check | test result |
xml fixture under test |
root |
| child1 | some text |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
| child3 |
| | leaf | name | value |
|
xml fixture under test |
root |
| child1 | some text |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
out of order | child3 |
out of order | | leaf | name | value |
|
|
xml fixture under test |
root |
| child1 | some text |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
| child3 |
| | leaf | name | value |
| then result is |
xml fixture under test |
root |
| child1 | some text |
| child2 | text1text2 | item1 | value1 | item2 | value2 |
out of order | child3 |
out of order | | leaf | name | value |
|