Chooses the expectation column by the header pattern
All 4 scenarios hold
A published table carries more than its text. The reporter marks which column names the scenario, and which column holds the expectation. It also records how each row fared when it ran.
A mark needs somewhere to live, and the three formats put one in different places. HTML sets a class on the cell. AsciiDoc puts a role prefix on the value. Markdown has nowhere at all. The rules below therefore print the cell each format published, and never name the mark. A reader can then see the difference.
Each rule names the sample test class it reads. Its rows are the columns, or the rows, of that class's table.
The question mark is the default alone. The JUnit configuration parameter tabletest.reporter.expectation.pattern holds the pattern, and the reporter matches it against the whole header. A project that words its expectations differently therefore says so once.
A pattern you set replaces the default, and does not add to it. Under a pattern of your own, a header ending in a question mark is an ordinary column again.
These rows read ExpectationPatternSample: Scenario | Year | Leap? | Expected note.
| Scenario | Expectation pattern | Column | In markdown? | In AsciiDoc? | In HTML? |
|---|---|---|---|---|---|
| A query header, by default | Leap? | Leap? | [.expectation]#++Leap?++# | <th class="cell expectation"><span class="literal">Leap?</span></th> | |
| A wordy header, by default | Expected note | Expected note | ++Expected note++ | <th class="cell"><span class="literal">Expected note</span></th> | |
| A query header, under your pattern | ^Expected.* | Leap? | Leap? | ++Leap?++ | <th class="cell"><span class="literal">Leap?</span></th> |
| A wordy header, under your pattern | ^Expected.* | Expected note | Expected note | [.expectation]#++Expected note++# | <th class="cell expectation"><span class="literal">Expected note</span></th> |