Logo: Relish

  1. Sign up
  2. Sign in

Project: Cucumber

Wire protocol

Cucumber's wire protocol allows step definitions to be
implemented and invoked on any platform.

Communication is over a TCP socket, which Cucumber connects to when it finds
a definition file with the .wire extension in the step_definitions folder
(or other load path). Note that these files are rendered with ERB when loaded.

A WirePacket flowing in either direction is formatted as a JSON-encoded
string, with a newline character signaling the end of a packet. See the
specs for Cucumber::WireSupport::WirePacket for more details.

Cucumber sends the following request messages out over the wire:

  • step_matches - Find out whether the wire server has a definition for a step
  • invoke - Ask for a step definition to be invoked
  • begin_scenario - signals that cucumber is about to execute a scenario
  • end_scenario - signals that cucumber has finished executing a scenario
  • snippet_text - requests a snippet for an undefined step

Every message supports two standard responses:

  • success - expects different arguments (sometimes none at all) depending on the request that was sent.
  • fail - causes a Cucumber::WireSupport::WireException to be raised.

Some messages support more responses - see individual scenarios for details.

Topics

  1. ERB configuration
  2. Handle unexpected response
  3. Invoke message
  4. Snippets message
  5. Step matches message
  6. Wire protocol table diffing
  7. Wire protocol tags
  8. Wire protocol timeouts

Last published over 2 years ago by mattwynne.