Class: Cucumber::Distrib::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/distrib/events.rb

Overview

Custom objects to represent events from workers on Leader for reporters. This is necessary because original events are not Marshalable.

Defined Under Namespace

Classes: BaseTestCaseEvent, BaseTestStepEvent, Envelope, Event, Exception, Expression, GherkinSourceParsed, GherkinSourceRead, Group, Hook, HookStep, HookTestStepCreated, Pattern, RetryingTest, SourceReference, StepActivated, StepArgument, StepDefinition, StepDefinitionRegistered, StepMatch, TestCaseCreated, TestCaseFinished, TestCaseReady, TestCaseStarted, TestReported, TestStepCreated, TestStepFinished, TestStepStarted, UndefinedParameterType

Class Method Summary collapse

Class Method Details

.convert(event) ⇒ Cucumber::Distrib::Events::Event

Convert core event.

Parameters:

  • event (Cucumber::Core::Event)

Returns:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/cucumber/distrib/events.rb', line 14

def convert(event) # rubocop:disable Metrics/MethodLength,Metrics/AbcSize,Metrics/CyclomaticComplexity
  case event
  when ::Cucumber::Events::Envelope
    Cucumber::Distrib::Events::Envelope.new(event)
  when ::Cucumber::Events::GherkinSourceParsed
    Cucumber::Distrib::Events::GherkinSourceParsed.new(event)
  when ::Cucumber::Events::GherkinSourceRead
    Cucumber::Distrib::Events::GherkinSourceRead.new(event)
  when ::Cucumber::Events::HookTestStepCreated
    Cucumber::Distrib::Events::HookTestStepCreated.new(event)
  when ::Cucumber::Events::StepActivated
    Cucumber::Distrib::Events::StepActivated.new(event)
  when ::Cucumber::Events::StepDefinitionRegistered
    Cucumber::Distrib::Events::StepDefinitionRegistered.new(event)
  when ::Cucumber::Events::TestCaseCreated
    Cucumber::Distrib::Events::TestCaseCreated.new(event)
  when ::Cucumber::Events::TestCaseFinished
    Cucumber::Distrib::Events::TestCaseFinished.new(event)
  when ::Cucumber::Events::TestCaseStarted
    Cucumber::Distrib::Events::TestCaseStarted.new(event)
  when ::Cucumber::Events::TestCaseReady
    Cucumber::Distrib::Events::TestCaseReady.new(event)
  when ::Cucumber::Events::TestStepCreated
    Cucumber::Distrib::Events::TestStepCreated.new(event)
  when ::Cucumber::Events::TestStepFinished
    Cucumber::Distrib::Events::TestStepFinished.new(event)
  when ::Cucumber::Events::TestStepStarted
    Cucumber::Distrib::Events::TestStepStarted.new(event)
  when ::Cucumber::Events::UndefinedParameterType
    Cucumber::Distrib::Events::UndefinedParameterType.new(event)
  else
    raise "Can't convert #{event}"
  end
end

.leader_registryHash

Returns custom event registry for Leader.

Returns:

  • (Hash)

    custom event registry for Leader



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/cucumber/distrib/events.rb', line 58

def leader_registry # rubocop:disable Metrics/MethodLength
  ::Cucumber::Events.registry.merge ::Cucumber::Core::Events.build_registry(
    ::Cucumber::Distrib::Events::Envelope,
    ::Cucumber::Distrib::Events::GherkinSourceParsed,
    ::Cucumber::Distrib::Events::GherkinSourceRead,
    ::Cucumber::Distrib::Events::HookTestStepCreated,
    # A distrib custom event to signal that a test has been reported to leader
    ::Cucumber::Distrib::Events::RetryingTest,
    ::Cucumber::Distrib::Events::StepActivated,
    ::Cucumber::Distrib::Events::StepDefinitionRegistered,
    ::Cucumber::Distrib::Events::TestCaseCreated,
    ::Cucumber::Distrib::Events::TestCaseFinished,
    ::Cucumber::Distrib::Events::TestCaseReady,
    ::Cucumber::Distrib::Events::TestCaseStarted,
    # A distrib custom event to signal that a test has been reported to leader
    ::Cucumber::Distrib::Events::TestReported,
    # Those are emitted on the leader side:
    # ::Cucumber::Distrib::Events::TestRunFinished,
    # ::Cucumber::Distrib::Events::TestRunStarted,
    ::Cucumber::Distrib::Events::TestStepCreated,
    ::Cucumber::Distrib::Events::TestStepFinished,
    ::Cucumber::Distrib::Events::TestStepStarted,
    ::Cucumber::Distrib::Events::UndefinedParameterType
  )
end

.worker_registryHash

Returns custom event registry for workers.

Returns:

  • (Hash)

    custom event registry for workers



50
51
52
53
54
55
# File 'lib/cucumber/distrib/events.rb', line 50

def worker_registry
  ::Cucumber::Events.registry.merge ::Cucumber::Core::Events.build_registry(
    ::Cucumber::Distrib::Events::RetryingTest,
    ::Cucumber::Distrib::Events::TestReported
  )
end