Gherkin to Robot Framework Converter
Welcome to the Gherkin to Robot Framework Converter project! This tool is designed to help you bridge the gap between Gherkin's human-readable specifications and Robot Framework's powerful automation capabilities.
This project aims to parse Gherkin .feature files and automatically generate .robot files suitable for execution with Robot Framework.
Gherkin and Cucumber
Gherkin is a Business Readable, Domain Specific Language (DSL) that lets you describe software’s behavior without detailing how that behavior is implemented. It is designed to be easy to understand by non-technical stakeholders.
Cucumber is a tool that executes Gherkin specifications. It reads Gherkin documents and runs the steps defined in them. These steps are typically written in a programming language like Python or Java.
The basic Gherkin syntax includes the following keywords:
Feature: Describes a software feature, and groups related scenarios.Scenario: Describes a particular example of the feature's behavior.Given: Describes the initial context or preconditions.When: Describes an action or event.Then: Describes the expected outcome or result.And,But: Used to add moreGiven,When, orThensteps.
Robot Framework
Robot Framework is a generic open-source automation framework. It can be used for test automation and robotic process automation (RPA). It has easy-to-use tabular syntax and it utilizes the keyword-driven testing approach. Its testing capabilities can be extended by test libraries implemented either with Python or Java.
Robot Framework's keyword-driven approach means that test cases are created using keywords, which are pre-defined or user-defined actions. This makes the tests easy to read and write, even for people who are not programmers.
Robot Framework can be used with Gherkin in a few ways:
- Converting Gherkin to Robot tests: This is what this project aims to do. By converting Gherkin
.featurefiles into.robotfiles, you can leverage Robot Framework's execution engine and reporting capabilities. - Using libraries: Some libraries allow Robot Framework to understand Gherkin syntax directly or provide a way to map Gherkin steps to Robot Framework keywords.
Gherkin Language Parser Workflow
The following diagram illustrates the process of parsing Gherkin .feature files:
graph TD
Input[".feature file (Raw Text)"] --> Lexer["Lexical Analyzer (Tokenizer)"]
Lexer --> Tokens["Token Stream"]
Tokens --> Parser["Syntax Analyzer (Parser)"]
Grammar["Gherkin Grammar Rules"] --> Parser
Parser --> AST["Abstract Syntax Tree (AST)"]
(Note: The original D2 source for a similar diagram is available in the diagrams/gherkin_parser_workflow.d2 file.)
Project's Gherkin Parser Implementation
This project utilizes a Gherkin parser, following the principles illustrated in the diagram above, to process .feature files. The core parsing logic can be found in src/gherkbot/parser.py. The Abstract Syntax Tree (AST) generated by this parser serves as the crucial structured data input for the src/gherkbot/converter.py module. This converter module is then responsible for transforming the Gherkin AST into executable Robot Framework test cases (.robot files).
Features
- Parses Gherkin syntax from
.featurefiles. - Converts Gherkin scenarios into Robot Framework test cases.
- (Future) Maps Gherkin steps to Robot Framework keywords.
Usage
The ultimate goal is to provide a command-line interface (CLI) tool for seamless conversion of Gherkin feature files to Robot Framework test files.
Intended Usage (Under Development):
python -m gherkbot.cli --input path/to/your/file.feature --output path/to/your/outputfile.robot
- Input: Path to a Gherkin
.featurefile. - Output: Path to the generated Robot Framework
.robotfile.
Currently, the CLI and the full conversion logic are under active development. You can explore the existing parser and converter modules directly:
src/gherkbot/parser.py: Contains the Gherkin parsing logic.src/gherkbot/converter.py: Contains the logic for converting the parsed Gherkin AST to Robot Framework format.
Metadata
Release files for gherkbot 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| gherkbot-0.1.5.tar.gz | 44.2 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gherkbot-0.1.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 53.2 kB
Release files / gherkbot-0.1.5.tar.gz
| Download URL | gherkbot-0.1.5.tar.gz |
|---|---|
| Size | 44.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b8ca3263e4665c44ee609571d5093141c674b7dcd54a73771f7084ec74be2b5
|
|
BLAKE2b-256 checksum How to use checksums |
aee068537b65aae6909c8b25dd0b63bc1b36cb4db8f7928bd6de5fe094ce7ac8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2025.
Transparency logRelease files / gherkbot-0.1.5-py3-none-any.whl
| Download URL | gherkbot-0.1.5-py3-none-any.whl |
|---|---|
| Size | 9.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c9e5fb4af6b78714180045ff57965f727d74da0052cb0fb0db4827828247312
|
|
BLAKE2b-256 checksum How to use checksums |
716f2b54bd0f5c8f6ba6370dead5abded37b87101f40f7d2751cbb9cafced9c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2025.
Transparency logSecurity for gherkbot 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for gherkbot-0.1.5.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 11, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.