Package: gherkin2robotframework
gherkin2robotframeworkDescriptionThis tool can be used to facilitate the usage of Cucumber feature files in a RobotFramework Test Automation solution.
Although RobotFramework supports BDD style test cases, this support is limited to Given/When/Then keywords.
Features like datatables and docstrings are not supported in RobotFramework.
This tool will 'compile' Gherkin feature files into RobotFramework test cases and scaffolding for step definitions
aka User Keywords.UsageExample featureFeature:ExamplesAs a testerI want to specify feature files and translate it to RobotFrameworkSo I can use the best of both worldsBackground:Givensome background stuffScenario:GreeterGivena greeterWhengreeting the following persons:|Name|Greeting||Joe|Hello||Mary|Hi, there!|Thenthe wold is a better place@tagScenario Outline:Repetitive stuffAnice descriptionon multiple linesGivena thing with "<thingy>"Whensome actionThenthis happened:<stuff>@AExamples:ADocumentation forexample A|thingy|stuff||AAA|123||BBB|456|@BExamples:BDocumentation for example B|thingy|stuff||CCC|789||DDD|000|First time generationAfter creating your feature files you can translate these into RobotFrame test scripts with the following command:gherkin2robotframework example.featureTwo files will be generated:example.robotcontaining the test cases andexample_step_definitions.robotcontaining
the user keywords implement the steps. For the default english gherkins the Given/When/Then will be stripped
from the keyword names.example.robot*** Settings ***DocumentationAs a tester...I want to specify feature files and translate it to RobotFramework...So I can use the best of both worldsResource./examples_step_definitions.robotMetadataFeatureExamplesMetadataGenerated by_gherkin2robotframework on 2020-01-31T13:23:34.958405_*** Test Cases ***GreeterBackgroundGivena greeter${DataTable}=Create ListFOR${Name}    ${Greeting}IN...JoeHello...MaryHi, there!${entry}=Create DictionaryName=${Name}Greeting=${Greeting}Append To List${DataTable}    ${entry}ENDWhengreeting the following persons:@{DataTable}Thenthe wold is a better placeRepetitive stuff: A[Documentation]Documentation for...example A[Tags]tagA[Template]Scenario Outline Repetitive stuffAAA123BBB456Repetitive stuff: B[Documentation]Documentation for example B[Tags]tagB[Template]Scenario Outline Repetitive stuffCCC789DDD000*** Keywords ***BackgroundGivensome background stuffScenario Outline Repetitive stuff[Documentation]A nice description...on multiple lines[Arguments]    ${thingy}    ${stuff}BackgroundGivena thing with "${thingy}"Whensome actionThenthis happened:${stuff}example_step_definitions.robot*** Settings ***DocumentationGenerated by_gherkin2robotframework on 2020-01-31T12:14:13.397524_LibraryCollections*** Keywords ***some background stuffFailKeyword "some background stuff" Not Implemented Yeta greeterFailKeyword "a greeter" Not Implemented Yetgreeting the following persons:[Arguments]    @{DataTable}FailKeyword "greeting the following persons:" Not Implemented Yetthe wold is a better placeFailKeyword "the wold is a better place" Not Implemented Yeta thing with "${thingy}"FailKeyword "a thing with "${thingy}"" Not Implemented Yetsome actionFailKeyword "some action" Not Implemented Yetthis happened:${stuff}FailKeyword "this happened:${stuff}" Not Implemented YetRegenerationIn case your feature file is changed the .robot files needs to be regenerated....Scenario:GreeterGivena greeterWhengreeting the following persons:|Name|Greeting||Joe|Hello||Mary|Hi, there!|Thenthe wold is a better placeAndthe sun will shine                    #  <-- New step...The files can be regenerated with the same command:gherkin2robotframework example.featureHowever, only the example.robot file will be generated (overwritten). The step definition will be parsed and
missing keywords will be generated to the console.Processing gherkin: E:\GitHubProjects\gherkin2robotframework\examples\examples.feature

Missing keywords for: E:\GitHubProjects\gherkin2robotframework\examples\examples_step_definitions.robot

the sun will shine
    Fail    Keyword "the sun will shine" Not Implemented YetLimitations and considerationsBackground supportTheBackgroundkeyword is generated to implement the background part of the feature file. Each test case will
include this keyword. Using[Test setup]will not work forScenario Outlinewith Examples.
In Cucumber the Background is applied to each example and in RobotFramework the[Test setup]is only applied to
the Test case andNOTto each line in the test case with[Test Template].Language support#language:xxis supported, but because the gherkin3 dependency is not recently updated on PyPI.
Therefore some keywords (and aliases) are not included.