Class: Cucumber::Messages::TestCase

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 TestCase message in Cucumber’s message protocol.

//// TestCases

*

A `TestCase` contains a sequence of `TestStep`s.

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(id: '', pickle_id: '', test_steps: []) ⇒ TestCase

Returns a new instance of TestCase.



1489
1490
1491
1492
1493
1494
1495
1496
1497
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1489

def initialize(
  id: '',
  pickle_id: '',
  test_steps: []
)
  @id = id
  @pickle_id = pickle_id
  @test_steps = test_steps
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



1480
1481
1482
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1480

def id
  @id
end

#pickle_idObject (readonly)

The ID of the ‘Pickle` this `TestCase` is derived from.



1485
1486
1487
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1485

def pickle_id
  @pickle_id
end

#test_stepsObject (readonly)

Returns the value of attribute test_steps.



1487
1488
1489
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.dtos.rb', line 1487

def test_steps
  @test_steps
end

Class Method Details

.from_h(hash) ⇒ Object

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

Cucumber::Messages::TestCase.from_h(some_hash) # => #<Cucumber::Messages::TestCase:0x... ...>


900
901
902
903
904
905
906
907
908
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/cucumber-messages-18.0.0/lib/cucumber/messages.deserializers.rb', line 900

def self.from_h(hash)
  return nil if hash.nil?

  self.new(
    id: hash[:id],
    pickle_id: hash[:pickleId],
    test_steps: hash[:testSteps]&.map { |item| TestStep.from_h(item) },
  )
end