Class: Cucumber::Messages::TestStep

Inherits:
Message show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb

Overview

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`.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Message::Utils

included

Methods included from Message::Serialization

#to_h, #to_json

Methods included from Message::Deserialization

included

Constructor Details

#initialize(hook_id: nil, id: '', pickle_step_id: nil, step_definition_ids: nil, step_match_arguments_lists: nil) ⇒ TestStep

Returns a new instance of TestStep.



1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1612

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

Instance Attribute Details

#hook_idObject (readonly)

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



1591
1592
1593
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1591

def hook_id
  @hook_id
end

#idObject (readonly)

Returns the value of attribute id.



1593
1594
1595
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1593

def id
  @id
end

#pickle_step_idObject (readonly)

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



1598
1599
1600
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1598

def pickle_step_id
  @pickle_step_id
end

#step_definition_idsObject (readonly)

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



1603
1604
1605
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1603

def step_definition_ids
  @step_definition_ids
end

#step_match_arguments_listsObject (readonly)

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`


1610
1611
1612
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1610

def step_match_arguments_lists
  @step_match_arguments_lists
end

Class Method Details

.from_h(hash) ⇒ Object

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... ...>


981
982
983
984
985
986
987
988
989
990
991
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 981

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