11# Cucumber Messages
22
33* Cucumber Messages* is a message protocol for representing results and other information
4- from Cucumber.
4+ from Cucumber. The protocol aims to decouple various components of the Cucumber platform, with the following advantages:
55
6- Cucumber Messages are currently implemented in the following versions of Cucumber (using the ` message ` formatter):
6+ * Each component only needs to know about a subset of messages
7+ * Gherkin is decoupled from the Cucumber execution component
8+ * Enables the future support other formats such as Markdown and Excel
9+
10+ ## Message Overview
11+
12+ ![ messages.png] ( messages.png )
13+
14+ Note: Markdown and Excel formats are currently not supported and mentioned here as potential future alternative languages to express BDD scenarios.
15+
16+ ## JSON Schema
17+
18+ The [ jsonschema] ( jsonschema ) directory contains [ JSON Schema] ( https://json-schema.org/ )
19+ definitions for each message type.
20+
21+ See [ messages.md] ( messages.md ) for a detailed description of each message type.
22+
23+ ## Encoding
24+
25+ When Cucumber Messages are stored in a file or sent over a network, they are
26+ encoded as [ NDJSON] ( http://ndjson.org/ ) . We call this a * message stream* .
27+
28+ Each message in a message stream is of type [ Envelope] ( messages.md#envelope ) .
29+
30+ ## Language implementations
31+
32+ Each subdirectory defines language-specific implementations of these messages,
33+ generated from the JSON schemas. The current implementation are:
34+ - .Net
35+ - Elixir
36+ - Go
37+ - Java
38+ - Javascript
39+ - Perl
40+ - PHP
41+ - Ruby
42+
43+ ## Message emitters
44+ Cucumber Messages are currently sent by the following versions of Cucumber (using the ` message ` formatter):
745
846* Cucumber-JVM 6.0.0 and greater
947* Cucumber-Ruby 4.0.0 and greater
1048* Cucumber.js 7.0.0 and greater
1149
12- The ` json ` formatter is now in maintenance mode for these these implementations, and Messages is the preferred standard.
13- See [ utilities] ( #utilities ) for a list of tools that may help with backward and forward compatibility
14- with the ` json ` format.
50+ Messages emitters for the other Cucumber languages (e.g. Perl) are not yet implemented.
1551
1652## Why Cucumber Messages
1753
1854Cucumber needs to produce results in a machine-readable format so that other tools can generate reports.
1955
20- +----------+ messages +-----------+
21- | Cucumber |---m-m-m-m-m-m-->| Formatter |
22- +----------+ +-----------+
56+ ![ messages-stream.svg] ( messages-stream.svg )
2357
2458Historically, Cucumber has done this with the ` json ` and ` junit ` formatters.
25- These formats have several shortcomings that are addressed by cucumber messages:
59+ These formats have several shortcomings that are addressed by Cucumber Messages.
60+
61+ The ` json ` formatter is now in maintenance mode for these implementations, and Messages is the preferred standard.
62+ See [ utilities] ( #utilities ) for a list of tools that may help with backward and forward compatibility
63+ with the ` json ` format.
2664
2765### High memory footprint
2866
@@ -34,7 +72,7 @@ This can cause out of memory errors, aborting Cucumber runs or reporting jobs. I
3472consumed by downstream processors until the last scenario has finished.
3573
3674With Cucumber Messages, several messages containing smaller pieces of information are emitted
37- continuously to a * stream* , avoiding high memory consumption and enabling real-time processing
75+ continuously to a * stream* (NDJSON, see above) , avoiding high memory consumption and enabling real-time processing
3876of results.
3977
4078### Lack of a schema
@@ -66,35 +104,6 @@ However, it does not contain the following information (but Cucumber Messages do
66104This kind of information is required to produce rich reports and analytics, and is
67105used in [ @cucumber/react ] ( https://github.com/cucumber/cucumber-react ) and [ Cucumber Reports] ( https://reports.cucumber.io/ ) .
68106
69- ## Message Overview
70-
71- The protocol aims to decouple various components of the Cucumber platform so that:
72-
73- * Each component only needs to know about a subset of messages
74- * Gherkin is decoupled from the Cucumber execution component
75- * This is part of a strategy to support other formats such as Markdown and Excel
76-
77- ![ messages.png] ( messages.png )
78-
79- ## JSON Schema
80-
81- The [ jsonschema] ( jsonschema ) directory contains [ JSON Schema] ( https://json-schema.org/ )
82- definitions for each message type.
83-
84- See [ messages.md] ( messages.md ) for a detailed description of each message type.
85-
86- ## Encoding
87-
88- When Cucumber Messages are stored in a file or sent over a network, they are
89- encoded as [ NDJSON] ( http://ndjson.org/ ) . We call this a * message stream* .
90-
91- Each message in a message stream is of type [ Envelope] ( messages.md#envelope ) .
92-
93- ## Language implementations
94-
95- Each subdirectory defines language-specific implementations of these messages,
96- generated from the JSON schemas.
97-
98107## Examples
99108
100109You will find examples of Cucumber Messages in the [ compatibility-kit] ( https://github.com/cucumber/compatibility-kit/ ) project.
0 commit comments