class Cucumber::Messages::TestStep

Represents the TestStep message in Cucumber's message protocol.

*

A `TestStep` is derived from either a `PickleStep`
combined with a `StepDefinition`, or from a `Hook`.

Attributes

hook_id[R]

Pointer to the `Hook` (if derived from a Hook)

id[R]
pickle_step_id[R]

Pointer to the `PickleStep` (if derived from a `PickleStep`)

step_definition_ids[R]

Pointer to all the matching `StepDefinition`s (if derived from a `PickleStep`)

step_match_arguments_lists[R]

A list of list of StepMatchArgument (if derived from a `PickleStep`).

Each element represents a matching step definition. A size of 0 means `UNDEFINED`,
and a size of 2+ means `AMBIGUOUS`

Public Class Methods

from_h(hash) click to toggle source

Returns a new TestStep from the given hash. If the hash keys are camelCased, they are properly assigned to the corresponding snake_cased attributes.

Cucumber::Messages::TestStep.from_h(some_hash) # => #<Cucumber::Messages::TestStep:0x... ...>
# File lib/cucumber/messages.deserializers.rb, line 980
def self.from_h(hash)
  return nil if hash.nil?

  self.new(
    hook_id: hash[:hookId],
    id: hash[:id],
    pickle_step_id: hash[:pickleStepId],
    step_definition_ids: hash[:stepDefinitionIds],
    step_match_arguments_lists: hash[:stepMatchArgumentsLists]&.map { |item| StepMatchArgumentsList.from_h(item) },
  )
end
new( hook_id: nil, id: '', pickle_step_id: nil, step_definition_ids: nil, step_match_arguments_lists: nil ) click to toggle source
# File lib/cucumber/messages.dtos.rb, line 1610
def initialize(
  hook_id: nil,
  id: '',
  pickle_step_id: nil,
  step_definition_ids: nil,
  step_match_arguments_lists: nil
)
  @hook_id = hook_id
  @id = id
  @pickle_step_id = pickle_step_id
  @step_definition_ids = step_definition_ids
  @step_match_arguments_lists = step_match_arguments_lists
end