Writes a rich report of the scenario and example execution as it happens. Useful when running Cucumber from the terminal.
Each step is colored according to the outcome. When the cucumber
theme is in
use the following colors are used.
Cucumber Outcome | Color |
---|---|
UNKNOWN | n/a |
PASSED | Green |
SKIPPED | Cyan |
PENDING | Yellow |
UNDEFINED | Yellow |
AMBIGUOUS | Red |
FAILED | Red |
The messages to pretty writer can be configured with a custom theme. For example to remove all colors.
var writer = MessagesToPrettyWriter.builder()
.theme(Theme.builder()
.style(FEATURE_KEYWORD, Ansi.with(BOLD), Ansi.with(BOLD_OFF))
.style(RULE_KEYWORD, Ansi.with(BOLD), Ansi.with(BOLD_OFF))
.style(SCENARIO_KEYWORD, Ansi.with(BOLD), Ansi.with(BOLD_OFF))
.style(STEP_ARGUMENT, Ansi.with(BOLD), Ansi.with(BOLD_OFF))
.style(STEP_KEYWORD, Ansi.with(BOLD), Ansi.with(BOLD_OFF))
.build())
.build(System.out);
If Cucumber is executing scenarios and examples in parallel their steps will interleave in the reporting. This is an unavoidable side effect of executing in parallel. The visual clutter can be somewhat reduced by removing the feature and rule lines from the output.
var writer = MessagesToPrettyWriter.builder()
.feature(INCLUDE_FEATURE_LINE, false)
.feature(INCLUDE_RULE_LINE, false)
.build(System.out);
The location of steps and scenarios is included comment (following the #
).
Typically, this is a fully qualified URL, which can clutter up the output. This
url can be made shorter by removing the prefix from it. For example:
var cwdUri = new File("").toURI().toString();
var writer = MessagesToPrettyWriter.builder()
.removeUriPrefix(cwdUri)
.build(System.out);
Each language implementation validates itself against the examples in the
testdata
folder. See the testdata/README.md for more
information.