Introduction
The rcor command verifyRows can be used to simplify making assertions in a table.
Example
...
<table concordion:verifyRows="#users = getSearchResultsFor(#searchString)">
<tr>
<th concordion:assertEquals="#user.name">Matching Usernames</th>
<th concordion:assertEquals="#user.other">and their Other field</th>
</tr>
<tr>
<td>george.harrison</td>
<td>dishwasher</td>
</tr>
<tr>
<td>ringo.starr</td>
<td>chucknorris</td>
</tr>
</table>Discussion
For each row in the table (each tr):
- a variable is bound (here, #user) for each member of the set (here, #users).
- the assertions defined on the header are run for each column, respectively. (here, the first column is corresponds to the "name" column, because we call '#user.name' in our assertion).
A few things to note:
- the verifyRows command will fail -- its table will be assigned a concordion_failure style -- if the number of result rows defined (here, 2) does not match the size of the set returned by the fixture (here, the return value of getSearchResultsFor()).
- If the fixture returns too many rows, they will be denoted "Surplus Rows returned by fixture" in the output.
- If the fixture returns too few rows, each row listed in the spec will by denoted with "more rows".
Attributed Output
Here is an excerpt from the output when run with the above (assuming the fixture provides the correct values):
<table class="concordion_success" concordion:verifyrows="#users = getSearchResultsFor(#searchString)">
<tr>
<th concordion:assertequals="#user.name">Matching Usernames</th>
<th concordion:assertequals="#user.other">and their Other field</th>
</tr>
<tr>
<td concordion:assertequals="#user.name" class="concordion_success">george.harrison</td>
<td concordion:assertequals="#user.other" class="concordion_success">dishwasher</td>
</tr>
<tr>
<td concordion:assertequals="#user.name" class="concordion_success">ringo.starr</td>
<td concordion:assertequals="#user.other" class="concordion_success">chucknorris</td>
</tr>
</table>