Cucumber Scenarion Class

Preface

This class is under io.cucumber.java8 package. We can use this as parameter in before and after hook methods. It helps to write text and embedding media into reports and inspecting results. This class extends java.lang.Object class.

Note: This class is not intended to be used to create reports. In that particular intention using `io.cucumber.plugin.Plugin` class would be more precise and this has much richer access.

Methods and their usage

attach

  • description: Attach data to the report(s).
  • examples:
     // 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");
    

getSourceTagNames

  • description: returns tags of this scenario.

getStatus

  • description: returns the current status of this test case

isFailed

  • description: true if and only if getStatus() returns “failed”

log

  • description: Outputs some text into the report.

getName

  • description: returns the name of the Scenario

getId

  • description: returns the id of the Scenario.

getUri

  • description: returns the uri of the Scenario.

getLine

  • description: the line in the feature file of the Scenario. If this is a Scenario from Scenario Outlines this will return the line of the example row in the Scenario Outline.

Inherited Methods (important ones)

getClass

  • description: returns The Class object that represents the runtime class of this object.

Assests