Skip to content
This repository was archived by the owner on Nov 16, 2018. It is now read-only.

Wire Protocol

dwhelan edited this page Aug 13, 2010 · 35 revisions

This page documents the details of the low-level wire protocol that Cucumber uses to list and invoke steps in a remote process.

This protocol is in flux. Please see wire protocol for discussions around this emerging protocol.

List Step Definitions

|-- list_step_definitions --->|
|<-------------------- ok --|

Request

{
  "version" : "1.0",
  "list_step_definitions" : ""
}

Response

{
  "version" : "1.0",
  "step_definitions": [
    { "id": "id1", "regexp": "regex1" },
    { "id": "id2", "regexp": "regex2" }
  ]
}

Invoke

|-- invoke --------->|
|<------------- ok --|
         OR
|<----- diff_table --|
|-- diff_response -->|
|<------------- ok --|
         OR
|<---- step_failed --|

Request

{
  "version" : "1.0",
  "invoke" : "id1",
  "params" : [ "foo", "bar" ]
}

Response

If the step is invoked successfully then an ‘ok’ response is returned:

{
  "version" : "1.0",
  "ok" : ""
}

OR If the step throws an exception then a ‘step_failed’ response is returned:

{
  "version" : "1.0",
  "step_failed" : {
    "exception" : "some exception type",
    "message" : "foo",
    "backtrace" : "bar"
  }
}

Table Diff

This message is sent by the wire server when it requires Cucumber to to a table diff when invoking a step.

|<------------ diff_table --|
|-- diff_response --------->|

Request

{
  "version" : "1.0",
  "diff_table" : "TBD",
}

Response

{
  "version" : "1.0",
  "diff_response" : "TBD"
}

General Failure Response

If the remote process cannot handle a request then it shall return a ‘failed’ response:

{
  "version" : "1.0",
  "failed" : {
    "exception" : "some exception type",
    "message" : "foo",
    "backtrace" : "bar"
  }
}

Clone this wiki locally