Skip to content

A Python package that converts Gherkin scenarios into Python dataclass objects.

License

Notifications You must be signed in to change notification settings

MarkLehoczky/gherkin-processor

Repository files navigation

GHERKIN PROCESSOR

Gherkin Processor is a Python package that processes Gherkin files into Python dataclasses. It provides utilities for validating, processing, and saving Gherkin scenarios in both text and JSON formats.


License Release

Build Issue

Python Versions OS Versions


Features

  • Gherkin scenario validation
  • Gherkin scenario syntax issue description
  • Gherkin scenario content processing into Python dataclass
  • Save processed scenarios in text or JSON format
  • Directly load scenarios from file paths

Installation

You can install the Gherkin Processor package by cloning the repository or downloading from the releases.

Clone the Repository

# 1. Clone the repository
git clone https://github.com/MarkLehoczky/gherkin-processor.git

# 2. Navigate to the cloned directory
cd gherkin-processor

# Install the package via 'pip'
pip install .

Download from Releases

  1. Go to the Releases page.
  2. Download the latest release.
  3. Extract the downloaded file.
  4. Navigate to the extracted directory.
  5. Install the package with the following command:
pip install .

Usage

Command Line Interface

The Gherkin Processor can be used via the command line interface (CLI).

gherkin-processor [-h] -i INPUT [-p] [-s] [--save-as-json] [--validate]

Options

-h, --help                 show this help message and exit
-i INPUT, --input INPUT    specify the input Gherkin file location to process
-p, --print                print the processed Gherkin scenario to the standard output
-s, --save                 save the processed Gherkin scenario to a file
--save-as-json             save the processed Gherkin scenario to a file in JSON format
--validate                 validate the input Gherkin file syntax

See the CLI examples for details.

Python API

The Gherkin Processor can also be used programmatically in a Python code.

from gherkin_processor.utils import scenario    # file
from gherkin_processor.scenario import Scenario # class

# Load and process the scenario from a file
processed_scenario: Scenario = scenario.load("path/to/scenario.feature")

# Save the processed scenario to a file
scenario.save(processed_scenario, "path/to/saved_scenario.feature")

See the API examples and Data class structure for details.

License

This project is licensed under MIT License.

About

A Python package that converts Gherkin scenarios into Python dataclass objects.

Topics

Resources

License

Stars

Watchers

Forks