gulp-yadda-steps

0.1.29 • Public • Published

gulp-yadda-steps

view on npm npm module downloads per month Dependency status Build Status CodeClimate Test Coverage

A gulp task to generate or update Yadda test step libraries from Gherkin features (natural language test scripts).

Usage

This gulp task expects a feature file, written in Gherkin syntax, as input, and outputs the matching Yadda test step libraries for this feature file.

As a gulp task

Require this package and use as part of your gulp task.

var GulpYaddaSteps = require('gulp-yadda-steps');
gulp.src('local.feature')
.pipe(new GulpYaddaSteps())
.pipe(fs.createWriteStream('output.js'));

API

Modules

gulp-yadda-stepsthrough2

A gulp task to generate or update Yadda test step libraries from Gherkin features (natural language test scripts).

/parserthrough2

Parser is a transform stream requiring a valid feature file. Parser will load test step libraries tagged in the feature (using @libraries=) and will attempt to load a file with the feature filename and suffix "-steps.js". If one or more libraries are found they will be used to find step matches in the feature and filter them from the output.

/renderthrough2

Render is a transform stream requiring a yadda parsed JSON file. Render will load test step libraries tagged in the feature (using @libraries=) and will attempt to load a file with the feature filename and suffix "-steps.js". If one or more libraries are found they will be used to find step matches in the feature and filter them from the output.

gulp-yadda-steps ⇒ through2

A gulp task to generate or update Yadda test step libraries from Gherkin features (natural language test scripts).

Returns: through2 - readable-stream/transform

Param Type Description
opts Object Task configuration options (see modules Parser and Render for more information)

Example
Given the feature file:

Feature: Generate test steps from gherkin features
As a developer
I want to be able to generate test step boilerplate code from gherkin features
So that I can focus effort on building quality test steps
 
Scenario: Generating test steps
 
Given I have a simple feature file
When I read the feature file
Then a test steps file is generated

When you pass the feature file to a new gulpYaddaSteps(), and pipe it to a given destination.

var gulpYaddaSteps = require('gulp-yadda-steps');
gulp.src('local.feature')
.pipe(new gulpYaddaSteps())
.pipe(fs.createWriteStream('output.js'));

Then you'll get a Yadda style test step library:

"use strict";
var English = require('yadda').localisation.English;
/* Feature: Generate test steps from gherkin features */
module.exports = (function() {
 return English.library()
   /* Generating test steps */
   .define("Given I have a simple feature file", function(done) {
       this.assert(false);
       done();
   })
   .define("When I read the feature file", function(done) {
       this.assert(false);
       done();
   })
   .define("Then a test steps file is generated", function(done) {
       this.assert(false);
       done();
   });
})();

Note that the output is a vinyl file which will have the filePath overridden if the libraryBasePath and featureBasePath options are set.

/parser ⇒ through2

Parser is a transform stream requiring a valid feature file. Parser will load test step libraries tagged in the feature (using @libraries=) and will attempt to load a file with the feature filename and suffix "-steps.js". If one or more libraries are found they will be used to find step matches in the feature and filter them from the output.

Returns: through2 - readable-stream/transform

Param Type Default Description
opts Object Parser configuration options
[opts.libraryBasePath=] string Specifies a path to the base location for the test step libraries. E.g. if the base path to the test step library is Test/unit/steps/ use path.join(__dirname, "./steps/") if the script is running from "Test/unit". Note: featureBasePath must also be set for this option to take effect.
[opts.featureBasePath=] string Specifies a path to the base location for the features. Note: libraryBasePath must also be set for this option to take effect.
[opts.librarySuffix] string "-steps" Specifies the suffix for step libraries

Example
Given the feature file:

Feature: Generate test steps from gherkin features
As a developer
I want to be able to generate test step boilerplate code from gherkin features
So that I can focus effort on building quality test steps
 
Scenario: Generating test steps
 
Given I have a simple feature file
When I read the feature file
Then a test steps file is generated

When you pass the feature file to a new Parser(), and pipe it to a given destination.

var Parser = require('gulp-yadda-steps').Parser;
gulp.src('local.feature')
.pipe(new Parser())
.pipe(fs.createWriteStream('output.json'));

Then you'll get a Yadda parsed JSON output:

{"feature":{"title":"Generate test steps from gherkin features","annotations":{},
"description":["As a developer","I want to be able to generate test step boilerplate code from gherkin features",
"So that I can focus effort on building quality test steps"],
"scenarios":[{"title":"Generating test steps",
"annotations":{},"description":[],
"steps":["Given I have a simple feature file","When I read the feature file","Then a test steps file is generated"]}]}}

Note that the output is a vinyl file which will have the filePath overridden if the libraryBasePath and featureBasePath options are set.

/render ⇒ through2

Render is a transform stream requiring a yadda parsed JSON file. Render will load test step libraries tagged in the feature (using @libraries=) and will attempt to load a file with the feature filename and suffix "-steps.js". If one or more libraries are found they will be used to find step matches in the feature and filter them from the output.

Returns: through2 - readable-stream/transform

Param Type Default Description
opts Object Parser configuration options
[opts.template_library] string "../templates/yadda_library.dust" Specifies a path to a template_library dust file. This file controls the layout of new step libraries.
[opts.template_insertion] string "../templates/yadda_insert.dust" Specifies a path to a template_insertion dust file. This file controls the layout for inserting steps into an existing step library. This template should use dust partial steps to insert generated steps from template_steps.
[opts.template_steps] string "../templates/yadda_steps.dust" Specifies a path to a template_steps dust file. This file controls the layout and generation of test steps.

Example
Given a yadda parsed JSON file:

{"feature":{"title":"Generate test steps from gherkin features","annotations":{},
"description":["As a developer","I want to be able to generate test step boilerplate code from gherkin features",
"So that I can focus effort on building quality test steps"],
"scenarios":[{"title":"Generating test steps",
"annotations":{},
"description":[],
"steps":["Given I have a simple feature file","When I read the feature file","Then a test steps file is generated"]}]}}

When you pass the yadda parsed JSON file to a new Render(), and pipe it to a given destination.

var Render = require('gulp-yadda-steps').Render;
gulp.src('output.json')
.pipe(new Render())
.pipe(fs.createWriteStream('output.js'));

Then you'll get a Yadda style test step library:

"use strict";
var English = require('yadda').localisation.English;
var assert = require('assert');
/* Feature: Generate test steps from gherkin features */
module.exports = (function() {
return English.library()
   /* Generating test steps */
   .define("Given I have a simple feature file", function(done) {
       assert(true);
       done();
   })
   .define("When I read the feature file", function(done) {
       assert(true);
       done();
   })
   .define("Then a test steps file is generated", function(done) {
       assert(true);
       done();
   });
})();

Note that the output is a vinyl file which will have the filePath overridden if the libraryBasePath and featureBasePath options are set.

documented by jsdoc-to-markdown.

Changelog

Type ID Summary
Version: 0.1.29 - released 2017-10-11
Non-functional MDGSTEP-50

Package: Update package dependencies

Version: 0.1.28 - released 2017-09-02
Non-functional MDGSTEP-49

Package: Update package dependencies

Version: 0.1.27 - released 2017-05-28
Non-functional MDGSTEP-48

Package: Update package dependencies

Version: 0.1.26 - released 2017-01-24
Non-functional MDGSTEP-47

Package: Update package dependencies

Version: 0.1.25 - released 2017-01-02
Non-functional MDGSTEP-46

Package: Update package dependencies

Version: 0.1.23 - released 2016-12-30
Non-functional MDGSTEP-45

Package: Update package dependencies

Version: 0.1.22 - released 2016-10-05
Non-functional MDGSTEP-44

Package: Update package dependencies

Version: 0.1.21 - released 2016-09-23
Non-functional MDGSTEP-43

Package: Update package dependencies

Version: 0.1.20 - released 2016-09-06
Non-functional MDGSTEP-42

Package: Update package dependencies

Version: 0.1.19 - released 2016-08-09
Non-functional MDGSTEP-41

Package: Update package dependencies

Version: 0.1.18 - released 2016-08-07
Non-functional MDGSTEP-40

Package: Update package dependencies

Version: 0.1.17 - released 2016-03-28
Non-functional MDGSTEP-39

Package: Update package dependencies

Version: 0.1.16 - released 2016-02-16
Non-functional MDGSTEP-38

Package: Update package dependencies

Non-functional MDGSTEP-37

Package: Update package dependencies

Version: 0.1.15 - released 2015-11-13
Non-functional MDGSTEP-36

Package: Update package dependencies

Version: 0.1.14 - released 2015-08-25
Non-functional MDGSTEP-28

Package: Update package dependencies

Non-functional MDGSTEP-27

Package: Update package dependencies

Non-functional MDGSTEP-35

Package: Update development dependencies and configure for travis-ci

Non-functional MDGSTEP-34

Package: Update package dependencies

Non-functional MDGSTEP-33

Package: Update package dependencies

Non-functional MDGSTEP-32

Package: Update package dependencies

Non-functional MDGSTEP-31

Package: Update package dependencies

Non-functional MDGSTEP-30

Package: Update package dependencies

Bug MDGSTEP-29

Render: Fix missing callback err handling

Version: 0.1.13 - released 2015-05-24
Non-functional MDGSTEP-26

Package: Update development dependencies

Version: 0.1.12 - released 2015-05-21
Non-functional MDGSTEP-25

Package: Update package dependencies

Version: 0.1.11 - released 2015-05-20
Non-functional MDGSTEP-24

Package: Replace underscore.js with ramda.js

Non-functional MDGSTEP-23

Package: Update docs with updated jsdoc2markdown formatting

Non-functional MDGSTEP-22

Package: Update eslint configuration, test.js runner and dev dependencies

Non-functional MDGSTEP-21

Package: Update eslint configuration, test.js runner and dev dependencies

Version: 0.1.10 - released 2014-10-19
Non-functional MDGSTEP-20

Parser: Change option 'library_suffix' to camelcase 'librarySuffix'

Feature MDGSTEP-19

Template: Update step library template to match new eslint rules

As a developer I can automatically add missing steps to my step library based on my test feature So that I can make frequent changes to my test feature and keep my step library up to date with minimal time and effort

Non-functional MDGSTEP-18

Package: Migrate from jshint to eslint static code analysis

Version: 0.1.9 - released 2014-10-12
Non-functional MDGSTEP-17

Package: Update package dependencies

Non-functional MDGSTEP-16

Package: Remove all gulp tasks except 'test' and update readme docs

Version: 0.1.8 - released 2014-10-06
Non-functional MDGSTEP-15

Package: Update package dependencies

Version: 0.1.7 - released 2014-09-22
Non-functional MDGSTEP-14

Parser: Add error logger to require step library function

Version: 0.1.6 - released 2014-09-20
Bug MDGSTEP-9

Render: Fix steps not being created in existing step-libraries.

Feature MDGSTEP-13

Template: Update step library template to move all code within the module exports function

As a developer I want to be able to generate test step boilerplate code (within the module exports function) So that I can focus effort on building quality test steps

Version: 0.1.5 - released 2014-09-13
Feature MDGSTEP-8

Template: Update step library to require assert package.

As a developer I want to be able to generate test step boilerplate code that requires the assert package So that I can focus effort on building quality test steps

Version: 0.1.4 - released 2014-08-28
Non-functional MDGSTEP-6

Package: Migrate to new Cellarise Package Manager.

Version: 0.1.3 - released 2014-08-17
Bug MDGSTEP-5

Render: Fix duplicate steps generated in output.

Duplicate steps being generated when I rerun the task

Version: 0.1.2 - released 2014-08-14
Bug MDGSTEP-4

Package: Fix path to main library in package.json.

Version: 0.1.0 - released 2014-08-13
Feature MDGSTEP-3

Package: Automate adding missing test steps from a test feature script.

As a developer I can automatically add missing steps to my step library based on my test feature So that I can make frequent changes to my test feature and keep my step library up to date with minimal time and effort

Feature MDGSTEP-2

Package: Generate test steps from gherkin features.

As a developer I want to be able to generate test step boilerplate code from gherkin features So that I can focus effort on building quality test steps

License

MIT License (MIT). All rights not explicitly granted in the license are reserved.

Copyright (c) 2015 John Barry

Dependencies

gulp-yadda-steps@0.1.28 - "MIT License (MIT)", documented by npm-licenses.

Readme

Keywords

none

Package Sidebar

Install

npm i gulp-yadda-steps

Weekly Downloads

42

Version

0.1.29

License

MIT License (MIT)

Last publish

Collaborators

  • cellarise