Giter Club home page Giter Club logo

cucumber-messages's Introduction

Cucumber Messages

Cucumber Messages is a message protocol for representing results and other information from Cucumber. The protocol aims to decouple various components of the Cucumber platform, with the following advantages:

  • Each component only needs to know about a subset of messages
  • Gherkin is decoupled from the Cucumber execution component
  • Enables the future support other formats such as Markdown and Excel

Message Overview

messages.png

Note: Markdown and Excel formats are currently not supported and mentioned here as potential future alternative languages to express BDD scenarios.

JSON Schema

The jsonschema directory contains JSON Schema definitions for each message type.

See messages.md for a detailed description of each message type.

Encoding

When Cucumber Messages are stored in a file or sent over a network, they are encoded as NDJSON. We call this a message stream.

Each message in a message stream is of type Envelope.

Language implementations

Each subdirectory defines language-specific implementations of these messages, generated from the JSON schemas. The current implementation are:

  • .Net
  • C++
  • Elixir
  • Go
  • Java
  • Javascript
  • Perl
  • PHP
  • Ruby

Message emitters

Cucumber Messages are currently sent by the following versions of Cucumber (using the message formatter):

  • Cucumber-JVM 6.0.0 and greater
  • Cucumber-Ruby 4.0.0 and greater
  • Cucumber.js 7.0.0 and greater

Messages emitters for the other Cucumber languages (e.g. Perl) are not yet implemented.

Why Cucumber Messages

Cucumber needs to produce results in a machine-readable format so that other tools can generate reports.

messages-stream.svg

Historically, Cucumber has done this with the json and junit formatters. These formats have several shortcomings that are addressed by Cucumber Messages.

The json formatter is now in maintenance mode for these implementations, and Messages is the preferred standard. See utilities for a list of tools that may help with backward and forward compatibility with the json format.

High memory footprint

JSON and XML production/consumption is done by serialising/deserialising an object graph. For "big" Cucumber runs this graph may consume a considerable amount of RAM, in particular if several large attachments (screenshots) are attached.

This can cause out of memory errors, aborting Cucumber runs or reporting jobs. It also means that no results can be consumed by downstream processors until the last scenario has finished.

With Cucumber Messages, several messages containing smaller pieces of information are emitted continuously to a stream (NDJSON, see above), avoiding high memory consumption and enabling real-time processing of results.

Lack of a schema

The JSON report does not have a formal schema. This has led to slightly inconsistent implementations of the JSON formatter in various Cucumber implementations. Consumers of the JSON format have to anticipate and detect these inconsistencies and try to cope with them.

Limited information

The junit XML format can only contain very limited information such as test case name and status. While there isn't an official schema for JUnit XML, there are a few defacto ones around, and they are very limited.

The json format represents the following information:

  • Gherkin source (as a rough and lossy representation of a Gherkin document's abstract syntax tree)
  • Attachments (formerly called embeddings)
  • Path and line for step definitions
  • Results for hooks

However, it does not contain the following information (but Cucumber Messages does):

  • Original source code of the Gherkin document
  • Gherkin document abstract syntax tree
  • Step definitions
  • Parameter types

This kind of information is required to produce rich reports and analytics, and is used in @cucumber/react and Cucumber Reports.

Examples

You will find examples of Cucumber Messages in the compatibility-kit project.

Utilities

cucumber-messages's People

Contributors

aslakhellesoy avatar renovate[bot] avatar renovate-bot avatar aurelien-reeves avatar mpkorstanje avatar vincent-psarga avatar davidjgoss avatar cukebot avatar wannesfransen1994 avatar mattwynne avatar ciaranmcnulty avatar gasparnagy avatar luke-hill avatar ehuelsmann avatar brasmusson avatar charlierudolph avatar dmboyd avatar jkronegg avatar chybz avatar nhojpatrick avatar krishnangovindraj avatar sebrose avatar vearutop avatar vincentcapicotto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.