Before or After Hooks that declare a parameter of this type will receive an instance of this class.
It allows writing text and embedding media into reports, as well as inspecting results (in an After block).
Note: This class is not intended to be used to create reports. To create custom reports use
the io.cucumber.plugin.Plugin class. The plugin system provides a much richer access to Cucumbers then
hooks after could provide. For an example see io.cucumber.core.plugin.PrettyFormatter.
Attributes
Graph
Supertypes
class Object
trait Matchable
class Any
Members list
Concise view
Value members
Concrete methods
def attach(data: Array[Byte], mediaType: String, name: String): Unit
Attach data to the report(s).
Attach data to the report(s).
// Attach a screenshot. See your UI automation tool's docs for
// details about how to take a screenshot.
scenario.attach(pngBytes, "image/png", "Bartholomew and the Bytes of the Oobleck");
To ensure reporting tools can understand what the data is a
mediaType must be provided. For example: text/plain,
image/png, text/html;charset=utf-8.
If this is a Scenario from Scenario Outlines this will return the id of
the example row in the Scenario Outline.
The id is not stable across multiple executions of Cucumber but does
correlate with ids used in messages output. Use the uri + line number to
obtain a somewhat stable identifier of a scenario.