cucumber-attic / cucumber-engine

Shared go binary that can be used by all language implementations
MIT License
6 stars 0 forks source link

Sequence diagram #9

Open aslakhellesoy opened 5 years ago

aslakhellesoy commented 5 years ago

Cucumber engine offers a message-based API for front-ends and reporters.

In order to understand the design of this message protocol, it would be useful to have a sequence diagram illustrating what messages are exhanged, in what order, in what direction, and between what components.

This diagram should ideally be generated from source - living documentation. This can be done by annotating the messages.proto file, and generating a file that can be further processed by a diagramming tool, such as:

charlierudolph commented 5 years ago

Put this together:

diagram

Source:

@startuml

group command flow

  Caller -> Engine : CommandStart
  note left: this is the first message

  group
    Engine -> Caller : CommandRunBeforeTestRunHooks
    Caller -> Engine : CommandActionComplete
  end

  loop for each test case
    Engine -> Caller : CommandInitializeTestCase
    Caller -> Engine : CommandActionComplete

    loop for each before test case hook
      Engine -> Caller : CommandRunBeforeTestCaseHook
      Caller -> Engine : CommandActionComplete
    end

    loop for each test step
      alt with step definition
        Engine -> Caller : CommandRunTestStep
        Caller -> Engine : CommandActionComplete
      else without step definition
        Engine -> Caller : CommandGenerateSnippet
        Caller -> Engine : CommandActionComplete
      end
    end

    loop for each after test case hook
      Engine -> Caller : CommandRunAfterTestCaseHook
      Caller -> Engine : CommandActionComplete
    end
  end

  group
    Engine -> Caller : CommandRunAfterTestRunHooks
    Caller -> Engine : CommandActionComplete
  end
end

group events (sent through out the command flow)
  Engine -> Caller: TestRunStarted
  Engine -> Caller: Source
  Engine -> Caller: GherkinDocument
  Engine -> Caller: Pickle
  Engine -> Caller: PickleAccepted
  Engine -> Caller: PickleRejected
  Engine -> Caller: Attachment
  Engine -> Caller: TestCasePrepared
  Engine -> Caller: TestCaseStarted
  Engine -> Caller: TestStepStarted
  Engine -> Caller: TestStepFinished
  Engine -> Caller: TestCaseFinished
  Engine -> Caller: TestRunFinished
  note right: this is the last message
end

@enduml

Diagram generated from inserting the source here: http://www.plantuml.com/plantuml