A utility to convert Robot Framework test suites into Gherkin-style .feature files, making it easy to migrate or document your tests for use with BDD tools like Cucumber, Behave, or SpecFlow.
- Converts
.robottest suites to.featurefiles - Preserves:
- Test case names as
Scenario:blocks - Robot tags as Gherkin
@tags - Test steps in
Given / When / Then / Andformat - Suite-level documentation as the
Feature:name - Setup and teardown keywords (as optional steps)
- Test case names as
- Supports nested test suites and structured keywords
- CLI and programmatic usage
*** Settings ***
Documentation Basket
... Tests related to basket (cart) of selected products
Resource ../Resources/Setup.robot
Suite Setup Setup Suite
Suite Teardown Teardown Suite
Test Setup Start At ProductInventory Page
Test Teardown Teardown Test
Test Tags basket
*** Test Cases ***
User can view a summary with a single product in the basket
[Tags] smoke regression
Given there are minimum products in the basket
When user views the basket contents
Then all the selected products should be listed
And the product details should be correctFeature: Basket
Tests related to basket (cart) of selected products
@basket @smoke @regression
Scenario: User can view a summary with a single product in the basket
Given there are minimum products in the basket
When user views the basket contents
Then all the selected products should be listed
And the product details should be correctpython bdd_converter.py path/to/tests.robot output/path/to/tests.robot: Path to your Robot Framework test file or directoryoutput/: Output directory for.featurefiles
Optional: specify a custom title for the feature
python bdd_converter.py path/to/tests.robot output/ --title "Basket"from bdd_converter import bdd_converter
bdd_converter('tests/my_suite.robot', 'output/')Each Robot test suite is converted into a .feature file named after the suite:
output/
└── Basket.feature
- Tags from both suite and individual test cases are included as
@tags - Setup and teardown steps can be optionally shown
- Control structures like
FOR,IF, andTRYare supported - All keyword arguments are preserved as plain text for readability
- Add step type inference (e.g. auto-prefix with Given/When/Then)
- CLI option to exclude teardown/setup
- HTML report showing original Robot steps and converted Gherkin
MIT License
Pull requests are welcome! For major changes, please open an issue first to discuss what you'd like to change.
Created by Matthew King – Test Automation Engineer