class Cucumber::Messages::Pickle
Represents the Pickle message in Cucumber’s message protocol.
A ‘Pickle` represents a template for a `TestCase`. It is typically derived from another format, such as [GherkinDocument](io.cucumber.messages.GherkinDocument). In the future a `Pickle` may be derived from other formats such as Markdown or Excel files.
By making ‘Pickle` the main data structure Cucumber uses for execution, the implementation of Cucumber itself becomes simpler, as it doesn’t have to deal with the complex structure of a [GherkinDocument](io.cucumber.messages.GherkinDocument).
Each ‘PickleStep` of a `Pickle` is matched with a `StepDefinition` to create a `TestCase`
Attributes
Points to the AST node locations of the pickle. The last one represents the unique id of the pickle. A pickle constructed from ‘Examples` will have the first id originating from the `Scenario` AST node, and the second from the `TableRow` AST node.
A unique id for the pickle
The language of the pickle
The location of this pickle in source file. A pickle constructed from ‘Examples` will point to the example row.
The name of the pickle
One or more steps
The uri of the source file
Public Class Methods
Source
# File lib/cucumber/messages/pickle.rb, line 93 def self.from_h(hash) return nil if hash.nil? new( id: hash[:id], uri: hash[:uri], location: Location.from_h(hash[:location]), name: hash[:name], language: hash[:language], steps: hash[:steps]&.map { |item| PickleStep.from_h(item) }, tags: hash[:tags]&.map { |item| PickleTag.from_h(item) }, ast_node_ids: hash[:astNodeIds] ) end
Returns a new Pickle from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.
Cucumber::Messages::Pickle.from_h(some_hash) # => #<Cucumber::Messages::Pickle:0x... ...>
Source
# File lib/cucumber/messages/pickle.rb, line 65 def initialize( id: '', uri: '', location: nil, name: '', language: '', steps: [], tags: [], ast_node_ids: [] ) @id = id @uri = uri @location = location @name = name @language = language @steps = steps @tags = tags @ast_node_ids = ast_node_ids super() end