class Cucumber::Messages::Pickle
Represents the Pickle
message in Cucumber’s message protocol.
//// Pickles
*
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. This is a [SHA1](https://en.wikipedia.org/wiki/SHA-1) hash from the source data and the `locations` of the pickle. This ID will change if source the file is modified.
The language of the pickle
The name of the pickle
One or more steps
The uri of the source file
Public Class Methods
Source
# File lib/cucumber/messages.deserializers.rb, line 609 def self.from_h(hash) return nil if hash.nil? self.new( id: hash[:id], uri: hash[:uri], 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.dtos.rb, line 1112 def initialize( id: '', uri: '', name: '', language: '', steps: [], tags: [], ast_node_ids: [] ) @id = id @uri = uri @name = name @language = language @steps = steps @tags = tags @ast_node_ids = ast_node_ids end