1.0.0 • Published 5 years ago

generator-cucumber-step-definitions v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

A package that generates step definitions in javascript based on cucumber feature files

demo

Installation

npm install -g yo
npm install -g generator-cucumber-step-definitions

OR

yarn global add yo
yarn global add generator-cucumber-step-definitions

Executing

~/.yarn/bin/yo

Then select Cucumber Step Definitions

Select path to the feature-file (without file extension). Next, select the location you want the step definitions file to be generated.

Examples

Feature: title
  Scenario: title
    Given precondition with "1" and "2"
    When action
    And addition
    Then testable outcome equals "1"

If you have same feature with parameters, you'll recieve:

const {defineSupportCode} = require('cucumber');

defineSupportCode(function ({Given, When, Then}) {
  Given(/^precondition with "(.*)" and "(.*)"$/, function (param1, param2) {
    return true;
  });
  When(/^action$/, function () {
    return true;
  });
  And(/^addition$/, function () {
    return true;
  });
  Then(/^testable outcome equals "(.*)"$/, function (param1) {
    return true;
  });
});

License

MIT ©