Concordion > Commands > "execute" >

Executing Tables

The execute command has special behaviour when placed on a <table> element. Instead of executing once, it executes every detail row in the table and transfers the commands from the header row to each detail row.

Note that if you add the attribute "concordion:example" to one of the header columns, then each row will be executed as an example. The example name for the row is set to the value of that column.

Example

<table concordion:execute="#username = generateUsername(#fullName)">
    <tr>
        <th concordion:set="#fullName">Full Name</th>
        <th concordion:assertEquals="#username">Username</th>
    </tr>
    <tr>
        <td>Fred Bloggs</td>
        <td>fredbloggs</td>
    </tr>
    <tr>
        <td>John Doe</td>
        <td>johndoe</td>
    </tr>
    <tr>
        <td>Winston Churchill</td>
        <td>winston</td>
    </tr>
</table>

If the method generateUsername() returns the full name in lowercase with spaces removed, when we run the test we expect: 2 successes and 1 failure and 0 exceptions to be reported. The failure will have an expected value of "winston" and an actual value of "winstonchurchill".

Further Details