Skip to main content

An Mkdocs Plugin that Injects Cucumber Results in your Living Documentation

Project description

Mkdocs Gherkin Results Plugin

This plugin parses and injects the results of a Cucumber test report back into your Mkdocs pages.

This allows to create a living documentation where your Cucumber scenarios are written in Gherkin format (see link bellow).

It works by parsing the Cucumber messages, generated during the tests, and injecting the results in the Markdown before it is parsed as HTML, using the on_page_markdown hook.

Features

  • Whenever a test case has passed, a checkmark will be added next to it.

    images/screenshot1.png

  • If a test case has failed a cross will be added.

  • Screenshot attachments

    images/screenshot2.png

Examples

Check the configuration example under example directory.

It configures both cucumber-js and mkdocs in the same directory.

To run the example, you need to:

  • Run the cucumber tests

    • cd tests/test-docs
    • npm i
    • npm run test
  • Run the mkdocs documentation

    • Create and activate your python venv, using your preferred method

    • Run the documentation generator

      python tests/test-docs/run.py

Installing

In your mkdocs.yaml add the following:

plugins:
- gherkin-plugin

Configuration

  • tests_root_path - Required. The relative path of where the cucumber tests are located. Example "./tests-e2e"

  • show_results - Boolean value that controls if the test results are shown next to each feature and step. Defaults to True

  • show_attachments - Boolean value that controls if the file attachements are shown in the final result. Defaults to True

  • messages_path - Location where to load the cucumber messages ndjson. Defaults to "gherkin_messages.ndjson"

Example:

plugins:
  show_attachments: True
  messages_path: "gherkin_messages.ndjson"

Dependencies

If you use screenshots attachments, you will need to add the following markdown dependencies as well:

markdown_extensions:
  - admonition
  - pymdownx.details
  - pymdownx.superfences

TODO

  • Fix pending steps not shown
  • Add a short video explaining how it all works

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs_gherkin_plugin-0.0.13.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mkdocs_gherkin_plugin-0.0.13-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_gherkin_plugin-0.0.13.tar.gz.

File metadata

  • Download URL: mkdocs_gherkin_plugin-0.0.13.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for mkdocs_gherkin_plugin-0.0.13.tar.gz
Algorithm Hash digest
SHA256 c557aaa695e2344675067936efb4efe3a11a981c736befcf9393d3453950492f
MD5 028a3c08115545324ce1afa7dc6e00dc
BLAKE2b-256 49922f4daff0a16248a3ca207d8504d4a0055d89e265dd3ad60f3e1243ae597c

See more details on using hashes here.

File details

Details for the file mkdocs_gherkin_plugin-0.0.13-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_gherkin_plugin-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 fcd6d9eff77dfecef054a587428c691d9470b77d72976b4fc4b5322a522b45f8
MD5 ace0cdd90fd234829d09f895485901ef
BLAKE2b-256 67c01526064091fb6036b3ab6d88538a30d7dbff49670e24e3997a1fe933466d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page