Skip to content

seize-the-dave/jbehave-to-gherkin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JBehave to Gherkin Build Status

Converts JBehave grammar to Gherkin for use by Cucumber, SpecFlow, Behat or behave.

Download

Download a the release JAR with all dependencies or the standalone release JAR.

Usage

JBehave to Gherkin is a Java application which reads a JBehave story from stdin, and writes a Gherkin feature to stdout, which means it works well with redirects and pipes.

$ java -jar jbehave-to-gherkin.jar < example.story > example.feature

Example Conversion

The following example shows the expected output for a sample story.

Input

Gherkin feature description

Meta:
@meta

Narrative:
In order to use Cucumber
As a business analyst
I want to convert my JBehave to Gherkin

Lifecycle:
Before:
Given I am a before step

Scenario: Gherkin scenario description
Meta:
@scenario-meta
Given I have some JBehave stories
|name|rank|
|Larry|Stooge 3|
|Moe|Stooge 1|
|Curly|Stooge 2|
When I execute jbehave-to-gherkin
Then I should have Gherkin features

Scenario: Second scenario
Meta:
@author Joe Bloggs
Given a [precondition] has occurred
When an action is performed
Then a [postcondition] should occur

Examples:
|precondition|postcondition|
|foo|bar|

Output

@meta
Feature: Gherkin feature description
  In order to use Cucumber
  As a business analyst
  I want to convert my JBehave to Gherkin

  Background: 
    Given I am a before step

  @scenario-meta
  Scenario: Gherkin scenario description
    Given I have some JBehave stories

      | name  | rank     |
      | Larry | Stooge 3 |
      | Moe   | Stooge 1 |
      | Curly | Stooge 2 |
    When I execute jbehave-to-gherkin
    Then I should have Gherkin features

  @author-joe-bloggs
  Scenario Outline: Second scenario
    Given a [precondition] has occurred
    When an action is performed
    Then a [postcondition] should occur

    Examples: 
      | precondition | postcondition |
      | foo          | bar           |

Limitations

There is no support for After steps or GivenStories from JBehave, as there is no corresponding keyword in Gherkin. Furthermore, Meta values are concatenated and converted to lowercase, so that "@name Foo Bar" in JBehave becomes "@name-foo-bar" in Gherkin.

There is also no support for the But step definition or DocStrings in Gherkin, as there is no corresponding structure in the JBehave grammar.

About

Convert JBehave stories to Gherkin features

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages