A typical use case when outcomes are collected in a tabular format is to verify them all at once. To this end, JBehave provides the OutcomesTable:
The user adds each outcome using a Hamcrest Matcher:The Matcher interface is contained in the hamcrest-core module. A collection of Matchers is contained in the hamcrest-library. You may choose to upgrade just the library module or provide your own custom implementations of Matcher.
Upon verification, the outcome matching is done and if any outcome verification fails an exception is thrown and the step execution fails and the entire outcomes table (including all verified outcomes) is reported to the StoryReporter. The TXT format would look like:
|Description|Value|Matcher|Verified| |Value1|Value1|"Value1"|Yes| |Value2|Value2|"ValueX"|No|
The HTML format would use colour-coding for failures.
The OutcomesTable is localisable, via the injection of the appropriate LocalizedKeywords.
The TXT format would look like, in FR locale:
|Déscription|Valeur|Matcher|Vérifié| |Value1|Value1|"Value1"|Oui| |Value2|Value2|"ValueX"|Non|