We're super excited to announce the latest (and, we hope, last) release candidate for Cucumber-ruby 4.
This new release introduces the following changes:
Cucumber::Messages
log
and attach
methods for step definitionscucumber-compatibility-kit
compliancemessage
formatterThe main change for this new release is the support of the new message
formatter, which produces all the
information about the test execution in a NDJSON
report.
This new formatter can be easily used with the command:
cucumber --format message
At the moment, we provide two tools supporting this new format:
json-formatter
html-formatter
This new message format is one of the most important building-blocks on which we are building the new versions of cucumber
.
log
and attach
in step definitionsIn order to have a more consistent API across different implementations of Cucumber, we have introduced two new methods usable inside step definitions:
log(message)
logs a String which will be handled by the formattersattach(data, media_type)
attaches a file alongside the reportThis release is also the first one that complies with the cucumber-compatibility-kit
,
which is a set of tests that ensures that all versions of Cucumber (Ruby, Java, Javascript ...) support the same set of features
and produce the same messages.
The built-in JSON formatter (when running cucumber --format=json
) is now deprecated in favor of the the message formatter used with the stand-alone json-formatter
.
Attaching files to the report should be done with attach
, and embed
is now deprecated. The same goes with the puts
methods, which should now be favored by log
.
This means that, when version 5.0 is out, when you use puts
inside a step definition, this will simply output to the console, without being passed to the formatters. In the meantime, a deprecation warning will be output -- you can use Kernel.puts
to avoid that warning.