Giter Club home page Giter Club logo

cucumber-expressions-extender's Introduction

cucumber-expression-extender

Prerequisites | Installation | Manual

Cucumber expression extender is a simple Cucumber's plugin to extend the tags expressions for easier feature files writings.

Why

It helps writing cleaner feature files without complex regular expressions.

Writing something like

Given 21-11-2015 is nice

can be translated by

Given('{dd-mm-yy} is nice '

Instead of:

Given(/^(\d+)\-(\d+)\-(\d+) is nice$/

Prerequisites

In order to use this plugin:

  • Cucumber must be installed.

Installation

To install the plugin to your project please use:

npm install cucumber-expression-extender

Manual

Once Cucumber expression extender is installed,

you can require it in your project:

require('cucumber-expression-extender');

And that's it,

you can now integrate it in your step definitions:

Given('{dd-mm-yy} is a nice date', 
(dateObject) => {
    console.log('indeed nice date ',
        dateObject.toString());
});

And you can use the new step in feature file

Given 01-02-21 is a nice date

Supported types

expression what is it examples
dd-mm-yy date pattern day(2 digits), month(2 digits), year(2 digits) 19-11-89, 19/11/89
mm-dd-yy date pattern month(2 digits), day(2 digits), year(2 digits) 11-19-89, 11/19/89
dd-mm-yyyy date pattern day(2 digits), month(2 digits), year(4 digits) 19-11-1989, 19/11/1989
mm-dd-yyyy date pattern month(2 digits), day(2 digits), year(4 digits) 11-19-1989, 11/19/1989
non-space any keyboard letters which are not spaces/tabs/new lines 312!`,.?;
env value stored in process.env[KEY] ENV["KEY"] or ENV['KEY']
array list of values separated by a comma "," a,b,b,c,!,`
int-array list of integer values separated by a comma "," 1,2,30,6
base2-array list of base2 (binary) values separated by a comma "," 1,001,110,101
base8-array list of base8 (octal) values separated by a comma "," 3,4,57,70
base16-array list of base16 (hex) values separated by a comma "," 4,5,C,FFF
float-array list of float values separated by a comma "," 1.0,2.3,4.3589
bool string value represnting true/false values true or TRUE or True or false or FALSE or False
bool-array list of boolean values separated by a comma "," true,FALSE,False,TRUE,True,false
json json structrue to later be converted to object

ensure you specify a valid JSON data

{"a":1, "b":2, "c":5, "e":"f"}

cucumber-expressions-extender's People

Contributors

shaynet10 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.