Class TestSourceParsed

java.lang.Object
io.cucumber.plugin.event.TestSourceParsed
All Implemented Interfaces:
Event

@API(status=EXPERIMENTAL) public final class TestSourceParsed extends Object
Provides abstract representation of a parsed test source.

Cucumber scenarios and individual examples in a scenario outline are compiled into pickles. These pickles are wrapped by a TestCase. As such Cucumbers internal representation lacks any hierarchy. I.e. once compiled into a a pickle a scenario is no longer associated with a feature file.

However consumers of Cucumbers output generally expect results to be reported in hierarchical fashion. This event allows test cases to be associated with with a Node in the hierarchy.

Note that this representation is intentionally abstract. To create more detailed reports that recreate a facsimile of the feature file it is recommended to use the Gherkin AST. This AST can be obtained by parsing the source provided by TestSourceRead event using gherkin.Parser or io.cucumber.gherkin.Gherkin.

Note that a test source may contain multiple root nodes. Though currently there are no parsers that support this yet.

  • Constructor Details

    • TestSourceParsed

      public TestSourceParsed(Instant timeInstant, URI uri, List<Node> nodes)
  • Method Details

    • getNodes

      public Collection<Node> getNodes()
      The root nodes in the parsed test source.
      Returns:
      root nodes in the parsed test source.
    • getUri

      public URI getUri()
    • getInstant

      public Instant getInstant()
      Returns instant from epoch.
      Specified by:
      getInstant in interface Event
      Returns:
      time instant in Instant
      See Also: